Skip to content

Commit

Permalink
added test for redirect back
Browse files Browse the repository at this point in the history
  • Loading branch information
capotej authored and rtomayko committed Feb 20, 2009
1 parent f3ed6e4 commit fa6eb90
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/helpers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
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
Expand Down

0 comments on commit fa6eb90

Please sign in to comment.