Testing code, which depends on default_url_options , causes all kinds of problems, see this thread and this issue for examples.
I solved the problem by correcting ActionDispatch::Routing::RouteSet in the tests to force the rails to include default values ββfor any parameters I want (in my case, locale ). See my answer to the github issue related to above for more details.
To override the host parameter using the same approach:
class ActionDispatch::Routing::RouteSet def url_for_with_host_fix(options) url_for_without_host_fix(options.merge(:host => 'localhost:3000')) end alias_method_chain :url_for, :host_fix end
Put this in a file in support should do the trick.
source share