1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

added test for redirect back

This commit is contained in:
Julio Capote 2009-02-20 16:58:20 -05:00 committed by Ryan Tomayko
parent f3ed6e4dd9
commit fa6eb90bf3

View file

@ -68,6 +68,20 @@ describe 'Helpers#redirect' do
assert_equal '', body
assert_equal '/foo', response['Location']
end
it 'redirects back to request.referer when passed back' do
mock_app {
get '/try_redirect' do
redirect back
end
}
request = Rack::MockRequest.new(@app)
response = request.get('/try_redirect', 'HTTP_REFERER' => '/foo')
assert_equal 302, response.status
assert_equal '/foo', response['Location']
end
end
describe 'Helpers#error' do