diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-02 14:47:03 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-02 14:47:03 +0000 |
commit | 4f754985d0d39a9e7831e45809b030b2b3c62d09 (patch) | |
tree | 94365183e680af76a6e1a9febe8fade7f9ae436b /actionpack/test | |
parent | 49cd52a93febcef28a5ae2ed5427294ec5159548 (diff) | |
download | rails-4f754985d0d39a9e7831e45809b030b2b3c62d09.tar.gz rails-4f754985d0d39a9e7831e45809b030b2b3c62d09.tar.bz2 rails-4f754985d0d39a9e7831e45809b030b2b3c62d09.zip |
Added redirect_to :back as a short-hand for redirect_to(request.env["HTTP_REFERER"])
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rwxr-xr-x | actionpack/test/controller/redirect_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index f18f3682de..4bad5e26ca 100755 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -22,6 +22,10 @@ class RedirectController < ActionController::Base redirect_to :action => "hello_world" end + def redirect_to_back + redirect_to :back + end + def rescue_errors(e) raise e end protected @@ -66,6 +70,12 @@ class RedirectTest < Test::Unit::TestCase get :redirect_with_assigns assert_equal "world", assigns["hello"] end + + def test_redirect_to_back + @request.env["HTTP_REFERER"] = "http://www.example.com/coming/from" + get :redirect_to_back + assert_redirect_url "http://www.example.com/coming/from" + end end module ModuleTest |