Named routes in functional tests (edge)

Hi –

I’m having trouble calling named routes in functional tests. Given
this in routes.rb

map_resources :tags

and this in my tags functional tests:

def test_route
tags_url # just calling it
end

I get this:

  1. Error:
    test_route(TagsControllerTest):
    NoMethodError: You have a nil object when you didn’t expect it!
    The error occurred while evaluating nil.rewrite
    /home/dblack/hacking/scratchpad-rest/config/…/vendor/rails/actionpack/lib/action_controller/base.rb:519:in
    url_for' (eval):19:intags_url’
    /home/dblack/hacking/scratchpad-rest/config/…/vendor/rails/actionpack/lib/action_controller/test_process.rb:438:in
    method_missing' tags_controller_test.rb:15:intest_route’

519 in base.rb is:

def url_for(options = {}, *parameters_for_method_reference)
case options
# some when clauses…
when Hash
@url.rewrite(rewrite_options(options)) # 519
end
end

The same thing happens if I do this in the application console.

Any suggestions/ideas?

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org

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