In integration tests, you can test the response of the server given a
url_for_options hash, like so:
get(:action, :param1 => "one", :param2 => "two", ...)
assert_response :success
However, this doesn't work with a named route.
# routes.rb
map.thing_download "things/:id/download" {:controller
=> :things, :action => :download}
# things_controller_test.rb:
get(:download, :id => @thing.id) #=> ActionController::RoutingError,
no route matches {:controller => :things, :action => :download, :id =>
12}
get(thing_download_path(@thing)) #=> ActionController::RoutingError,
no route matches {:controller => :things, :action => "/things/12/
download"}
Is there a way to get a response from a named route in functional
tests? For the time being I've resorted to misusing integration tests
for this purpose, because inheriting from
ActionController::IntegrationTest gives you a get() function that
takes a string, so I can do
get(thing_download_path(@thing))
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.