added test for redirect back
This commit is contained in:
parent
f3ed6e4dd9
commit
fa6eb90bf3
|
@ -68,6 +68,20 @@ describe 'Helpers#redirect' do
|
||||||
assert_equal '', body
|
assert_equal '', body
|
||||||
assert_equal '/foo', response['Location']
|
assert_equal '/foo', response['Location']
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe 'Helpers#error' do
|
describe 'Helpers#error' do
|
||||||
|
|
Loading…
Reference in New Issue