diff options
author | Jamis Buck <jamis@37signals.com> | 2005-08-06 08:37:25 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-08-06 08:37:25 +0000 |
commit | 50e247443371630e03cb360867770170a76ecb8b (patch) | |
tree | b1fa8948ded0f06fa573247882c03c617fb1c9b2 /actionpack/test | |
parent | a3469cadadfd770ad9029f651f3a51560bbd3045 (diff) | |
download | rails-50e247443371630e03cb360867770170a76ecb8b.tar.gz rails-50e247443371630e03cb360867770170a76ecb8b.tar.bz2 rails-50e247443371630e03cb360867770170a76ecb8b.zip |
Make assert_redirected_to properly check URL's passed as strings #1910 [Scott Barron]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1971 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 10 | ||||
-rw-r--r-- | actionpack/test/controller/fake_controllers.rb | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index e7faeb25cd..917ae330b6 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -20,6 +20,8 @@ class ActionPackAssertionsController < ActionController::Base def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end def redirect_to_path() redirect_to '/some/path' end + + def redirect_to_named_route() redirect_to route_one_url end # a redirect to an external location def redirect_external() redirect_to_url "http://www.rubyonrails.org"; end @@ -185,6 +187,14 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase process :redirect_external assert_redirect_url_match /ruby/ end + + # test the redirection to a named route + def test_assert_redirect_to_named_route + process :redirect_to_named_route + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to 'http://test.host/route_two' + end + end # test the flash-based assertions with something is in the flash def test_flash_assertions_full diff --git a/actionpack/test/controller/fake_controllers.rb b/actionpack/test/controller/fake_controllers.rb index 43f933b0d8..28136e09e8 100644 --- a/actionpack/test/controller/fake_controllers.rb +++ b/actionpack/test/controller/fake_controllers.rb @@ -19,5 +19,6 @@ module Object::Controllers end ActionController::Routing::Routes.draw do |map| + map.route_one 'route_one', :controller => 'elsewhere', :action => 'flash_me' map.connect ':controller/:action/:id' end |