Forum: Ruby on Rails Testing 404 responses

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.
72ea925c0ca3d19fdd2f12fa76681624?d=identicon&s=25 Stephan Wehner (stephanwehner)
on 2007-01-06 01:31
How can one get a hand on responses of a Rails application to arbitrary
requests to perform tests?

So far I found a testing method


but I feel a direct test may be more robust

I'd rather look at the response directly, such as

get 'this/url/doesn't/exist'
assert_equal @response.headers['Status'], '404'

get 'this!/!ur\l/doesn't/exist'
assert_equal @response.headers['Status'], '404'
# maybe even
assert_template :controller => 'error_handler', :action => 'error_page'

-- without specifying any controller.


This topic is locked and can not be replied to.