Adds failing test for after filters
This commit is contained in:
parent
13f8796771
commit
6f315b619c
|
@ -434,4 +434,33 @@ class AfterFilterTest < Test::Unit::TestCase
|
|||
get('/', {}, { 'HTTP_ACCEPT' => '*/*' })
|
||||
assert_body 'txt'
|
||||
end
|
||||
|
||||
it 'can catch exceptions in after filters and handle them properly' do
|
||||
doodle = ''
|
||||
mock_app do
|
||||
after do
|
||||
doodle += ' and after'
|
||||
raise StandardError, "after"
|
||||
end
|
||||
get :foo do
|
||||
doodle = 'Been now'
|
||||
raise StandardError, "now"
|
||||
end
|
||||
get :index do
|
||||
doodle = 'Been now'
|
||||
end
|
||||
error 500 do
|
||||
"We broke #{env['sinatra.error'].message}"
|
||||
end
|
||||
end
|
||||
|
||||
get '/foo'
|
||||
assert_equal 'We broke now', body
|
||||
assert_equal 'Been now', doodle
|
||||
|
||||
doodle = ''
|
||||
get '/'
|
||||
assert_equal 'We broke after', body
|
||||
assert_equal 'Been now and after', doodle
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue