Hi there,
wondering if anyone could help me here.
I’m trying to test some named routes with the following:
def test_route
opts = { :controller => “artists”, :action => “list” }
assert_routing “/admin/artists”, opts
# as per
http://www.robsanheim.com/2006/07/22/testing-named-routes-or-url_for-in-functional-test/
get :list
url = get general_artist_url # this is line 51 which breaks
assert_equal “/admin/artists”, url
…
end
I have a route (which I know already works…):
map.with_options :controller => ‘artists’ do |a|
a.general_artist ‘admin/artists/:action’, :requirements => { :action
=> /create|list|new|destroy/ }, :defaults => { :action => ‘list’ }
a.named_artist ‘admin/artists/:animate_artist/:action’,
:requirements => { :action => /edit|update|show|preview/ }
a.artist_form ‘admin/artists/:animate_artist/:action/:id’, :action
=> ‘list’
# add other options here if necessary later
end
and I get:
- Error:
test_routes(ArtistsControllerTest):
ActionController::UnknownAction: No action responded to
http://test.host/admin/artists
/Users/dorian/Sites/animate/rails/config/…/vendor/rails/actionpack/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
/opt/local/lib/ruby/1.8/benchmark.rb:293:inmeasure' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
/Users/dorian/Sites/animate/rails/config/…/vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in
perform_action' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/base.rb:381:in
send’
/Users/dorian/Sites/animate/rails/config/…/vendor/rails/actionpack/lib/action_controller/base.rb:381:in
process_without_filters' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:377:in
process_without_session_management_support’
/Users/dorian/Sites/animate/rails/config/…/vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in
process_without_test' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:16:in
process’
/Users/dorian/Sites/animate/rails/config/…/vendor/rails/actionpack/lib/action_controller/test_process.rb:363:in
process' /Users/dorian/Sites/animate/rails/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:336:in
get’
functional/artists_controller_test.rb:51:in `test_routes’
I’m not sure what this test.host is. I’m testing locally on my mac
laptop. My assert_routing is all working fine, but I would like to test
named_routes so that I can be sure they work when I use _url or url_for
in my app.
anyone have any ideas what might be happening here?
thanks
dorian
–
I do things for love or money