Skip to content

Rspec ignores default_url_options set in application_controller.rb #255

@adamtao

Description

@adamtao

Using Rails 3, I have a :scope in routes.rb:

scope "(/:locale)" do

  resources :products

end

In application_controller.rb I set the default :locale

def default_url_options(options={})

  {:locale => "en-US"}

end

In my views, this works when I test in my browser, but fails with Rspec:

<%= link_to product.name, product %>

While running specs I see:

No route matches {:action=>"show", :controller=>"products", :locale=>#&lt;Product id: ...&gt;}

So, Rspec is not using the default_url_options set in application_controller.rb.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions