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:
parent
f3ed6e4dd9
commit
fa6eb90bf3
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue