aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorDerek Prior <derekprior@gmail.com>2015-12-16 09:41:47 -0500
committerDerek Prior <derekprior@gmail.com>2015-12-16 11:42:25 -0500
commitdc4429ca3b21005d0016fca78967c2ebbe9677c9 (patch)
tree57651dd8a204da68fba0d3e800d413193fb67389 /actionpack/test/controller
parent13fd5586cef628a71e0e2900820010742a911099 (diff)
downloadrails-dc4429ca3b21005d0016fca78967c2ebbe9677c9.tar.gz
rails-dc4429ca3b21005d0016fca78967c2ebbe9677c9.tar.bz2
rails-dc4429ca3b21005d0016fca78967c2ebbe9677c9.zip
Deprecate `redirect_to :back`
Applications that use `redirect_to :back` can be forced to 500 by clients that do not send the HTTP `Referer` (sic) header. `redirect_back` requires the user to consider this possibility up front and avoids this trivially-caused application error.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/redirect_test.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index 28ff1f36cf..21dfd9cd03 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -191,7 +191,11 @@ class RedirectTest < ActionController::TestCase
def test_redirect_to_back_with_status
@request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
- get :redirect_to_back_with_status
+
+ assert_deprecated do
+ get :redirect_to_back_with_status
+ end
+
assert_response 307
assert_equal "http://www.example.com/coming/from", redirect_to_url
end
@@ -240,7 +244,11 @@ class RedirectTest < ActionController::TestCase
def test_redirect_to_back
@request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
- get :redirect_to_back
+
+ assert_deprecated do
+ get :redirect_to_back
+ end
+
assert_response :redirect
assert_equal "http://www.example.com/coming/from", redirect_to_url
end
@@ -248,6 +256,11 @@ class RedirectTest < ActionController::TestCase
def test_redirect_to_back_with_no_referer
assert_raise(ActionController::RedirectBackError) {
@request.env["HTTP_REFERER"] = nil
+
+ assert_deprecated do
+ get :redirect_to_back
+ end
+
get :redirect_to_back
}
end