title: Testing link_to without path in helper using Rspec
body: <p>Using the tip <a href="http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to#32-Link-to-same-URL-with-different-format" rel="nofollow">here</a> I have built a method in a helper module like so:</p>
  
  <pre><code>describe ExampleHelper do
    def build_link
      link_to "RSS feed", params.merge(:format =&gt; :rss), :class =&gt; "feed_link"
    end
  end
  </code></pre>
  
  <p>However, when I test this method I get the following error:</p>
  
  <pre><code> Failure/Error: subject { helper.build_link }
   ActionController::UrlGenerationError:
     No route matches {:action=&gt;"index", :foo=&gt;"bah", :foobah=&gt;["1", "2", "3"], :results_per_page=&gt;"25"}
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionpack-4.2.6/lib/action_dispatch/journey/formatter.rb:46:in `generate'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:721:in `generate'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:752:in `generate'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:799:in `url_for'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionpack-4.2.6/lib/action_dispatch/routing/url_for.rb:156:in `url_for'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionview-4.2.6/lib/action_view/routing_url_for.rb:94:in `url_for'
   # /Users/tombrammar/.rvm/gems/ruby-2.1.10@example/gems/actionview-4.2.6/lib/action_view/helpers/url_helper.rb:181:in `link_to'
  </code></pre>
  
  <p>It seems that because I'm testing within the helper it can't determine what controller to use and therefore how to build the url.</p>
  
  <p>Can anyone help me understand how to fix this? I.e. perhaps I can stub the controller the helper rspec?</p>