Routing: default value for component breaks functional test

All,

I’ve a problem with my routing settings. I added :lang default component
value to my routes.rb like this:

map.connect ‘’, :controller => ‘store’, :lang => ‘pl_PL’
map.connect ‘search’, :controller => ‘search’, :action => ‘search’,
:lang => ‘pl_PL’
map.connect ‘:controller/:action/:id’, :id => /\d+/, :lang => ‘pl_PL’

and it breaks my functional tests. Basically when I call get or post in
my tests like this:

post :destroy, :id => 1

it fails like this:

  1. Error:
    test_destroy(AdminControllerTest):
    ActionController::RoutingError: No url can be generated for the hash
    {:controller=>“admin”, :action=>“destroy”, :id=>“1”}
    generated_code/routing/generation.rb:67:in generate_default_path' c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:419:ingenerate_path’
    c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:415:in
    generate' c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:602:inextra_keys’
    c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/test_process.rb:86:in
    assign_parameters' c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/test_process.rb:295:inprocess’
    c:/Install/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/test_process.rb:307:in
    post' admin_controller_test.rb:80:intest_destroy’

I’m using Rails 1.0 with Webrick. Anyone knows how to fix this?

Thanks,
Maciej.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs