title: Combining url_helpers for a Rails engine and a base application in Rspec
body: <p>I have a Rails 3.2.15 application with an Engine mounted as follows at the top of <code>routes.rb</code>: </p>
  
  <pre><code>mount Service::Engine =&gt; '/'
  </code></pre>
  
  <p>While testing my application I'd like to use the routes url_helpers for my engine and if the route does not exist, fall back to the main application. </p>
  
  <p>For example, I have this route in the main app (<code>rake routes</code> output), which does NOT exist in the engine:</p>
  
  <pre><code>manager_account  GET  /manager/accounts/:id(.:format)     manager_accounts#show
  </code></pre>
  
  <p>I'm including url_helpers for both the application and the engine in <code>spec_helper.rb</code>:</p>
  
  <pre><code>RSpec.configure do |config|
    config.include Service::Engine.routes.url_helpers, type: :feature
    config.include Rails.application.routes.url_helpers, type: :feature
  end
  </code></pre>
  
  <p>My problem is that when I try to call <code>manager_account_path(account)</code> in my spec, I get the following error: </p>
  
  <pre><code>ActionController::RoutingError:
     No route matches {:action=&gt;"show", :controller=&gt;"manager_accounts", :id=&gt;...
  </code></pre>
  
  <p>If I call it as <code>main_app.manager_account_path(account)</code> then it succeeds but I'd really like to avoid having to specify that every time. Is there any way to set this up where I can use my url_helpers such that if a route doesn't exist in the engine, it'll fall back to the base application?</p>