title: Using the correct url_for method in a Rails engine spec
body: <p>I have a request spec in a Rails engine. The view that is rendered calls a route and passes in a hash, i.e. <code>projects_path(:scope =&gt; "user")</code>. A route like this will eventually call <code>url_for</code>, but <code>url_for</code> is defined in many places. When running the application or running a request spec in the main app (root level), the call chain ends up at <code>ActionView::RoutingUrlFor#url_for</code>; when running a spec in the engine, however, the call chain ends up at <code>ActionView::Helpers::UrlHelper#url_for</code>.</p>
  
  <p>In Rails 4, the <code>url_for</code> method defined in <code>UrlHelper</code> no longer accepts hash arguments, so I'm left with this error</p>
  
  <pre><code> Failure/Error: visit projects_opportunity_intakes_path
   ActionView::Template::Error:
     arguments passed to url_for can't be handled. Please require routes or provide your own implementation
  </code></pre>
  
  <p>What I'm trying to figure out is why the heck it's falling back on <code>ActionView::Helpers::UrlHelper</code> when I run a spec in my engine, but not in any other case. This is quite perplexing. One thing that stands out to me: when I put a breakpoint in my view and evaluate <code>self.class</code>, I <em>normally</em> get something that inherits from <code>ActionView::Base</code>, but when I run a spec from my engine, the class doesn't inherit from anything. I don't know if that's related, but it seems fishy.</p>
  
  <p>Anyone experience this? Know a way around it? Could my modules be getting included in the wrong order? Is there something in <code>spec_helper</code> or in the dummy app initialization that I can do to make sure that the right modules are being used?</p>