Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added test for redirect back

  • Loading branch information...
commit fa6eb90bf39921152d958bc26c1434a3ad69eeb9 1 parent f3ed6e4
@capotej capotej authored rtomayko committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/helpers_test.rb
View
14 test/helpers_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.