Forum: Ruby on Rails testing named routes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dorian M. (Guest)
on 2006-05-08 22:23
(Received via mailing list)
I'm trying to test routes named within a map.with_options statement.
I have in routes.rb:

  map.with_options :controller => 'films' do |f|
    f.overviews   'films/:index', :action => 'index', :requirements => {
:index => /index(artist|date|title)\.html/ }, :index => 'new'

and my test:
    opts = { :controller => "films", :action => "index", :index =>
"indexdate.html" }
    assert_routing overviews_url(:controller => "films", :index =>
"indexdate.html"), opts

which gives me:
  2) Error:
NoMethodError: You have a nil object when you didn't expect it!
The error occured while evaluating nil.rewrite
    generated/routing/named_routes/overviews.rb:2:in `overviews_url'
    functional/films_controller_test.rb:85:in `test_routes'

How can I reference a named route in map.with_options? or is this just
plain wrong :)



I do things for love or money
This topic is locked and can not be replied to.