Created
January 20, 2009 01:29
-
-
Save therealadam/49274 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
not_found do | |
'Bonk' | |
end | |
error(ActiveRecord::RecordNotFound) do | |
status(404) | |
'Aside not found' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it 'allows changing the response status from the error handler' do | |
mock_app { | |
not_found do | |
'I know exactly what that is!' | |
end | |
error FooNotFound do | |
status(404) | |
'I have no idea what that is' | |
end | |
get '/' do | |
raise FooNotFound | |
end | |
} | |
get '/' | |
assert_equal 404, status | |
assert_equal 'I have no idea what that is', body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment