integration tests don't use default_url_options with named routes

Hi All,

Integration tests don't generate routes using default_url_options
defined in application controller.
That would be okay if there were another way to specify them for
tests, but I can't find one.

Any help would be much appreciated!

To see this problem:

1) in routes.rb:
scope ':path_prefix' do
  resources :foos
end

2) in application_controller.rb
def default_url_options
  { :path_prefix => 'test' }
end

3) in test/integration/prefix_test.rb:
require 'test_helper'
class PrefixTest < ActionDispatch::IntegrationTest
  test "path prefix" do
    foos_path
  end
end

rake test:integration yields:
test_path_prefix(PrefixTest):
ActionController::RoutingError: No route matches {:controller=>"foos"}
    /test/integration/prefix_test.rb:5:in `test_path_prefix'

If I change foos_path to foos_path(:path_prefix => 'bar') it works
fine. I don't want to have to specify it everywhere, though, and
moreover in my real app, path_prefix gets set from
params[:path_prefix], so I'd really like it to automatically pick up
the appropriate values (as it does in the app -- this is only broken
in the tests).

Thanks in advance,

Nick Urban

P.S. It's worth mentioning that integration tests do make use of the
default_url_options in ActionDispatch::Integration::Session, but I
can't find any way to customize its behavior other than with a monkey
patch, and even then, I can't find a way to make it use
params[:path_prefix].