diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-12 19:35:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-12 19:35:30 +0000 |
commit | 61a6a440cb8bc4694828c437fb1996db270c9ee6 (patch) | |
tree | 9ea9e831e453537f9d5ca923ac5543dc25978b68 /actionpack/test | |
parent | 2c110b825e743f62c84a0c3e247ad524a9ac81c6 (diff) | |
download | rails-61a6a440cb8bc4694828c437fb1996db270c9ee6.tar.gz rails-61a6a440cb8bc4694828c437fb1996db270c9ee6.tar.bz2 rails-61a6a440cb8bc4694828c437fb1996db270c9ee6.zip |
Added follow_redirect method for functional tests that'll get-request the redirect that was made.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@585 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index b1875b8328..14ca462300 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -15,6 +15,10 @@ class ActionPackAssertionsController < ActionController::Base # a redirect to an internal location def redirect_internal() redirect_to "nothing"; end + def redirect_to_action() redirect_to :action => "flash_me"; end + + def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end + # a redirect to an external location def redirect_external() redirect_to_url "http://www.rubyonrails.org"; end @@ -342,6 +346,21 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase process :hello_xml_world assert_template_xpath_match('//p', %w( abes monks wiseguys )) end + + def test_follow_redirect + process :redirect_to_action + assert_redirected_to :action => "flash_me" + + follow_redirect + assert "Inconceivable!", @response.body + end + + def test_follow_redirect_outside_current_action + process :redirect_to_controller + assert_redirected_to :controller => "elsewhere", :action => "flash_me" + + assert_raises(RuntimeError, "Can't follow redirects outside of current controller (elsewhere)") { follow_redirect } + end end class ActionPackHeaderTest < Test::Unit::TestCase |