diff options
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index b359750d16..aae690d266 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -226,12 +226,41 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase # 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' + with_routing do |set| + set.draw do + set.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing' + set.connect ':controller/:action/:id' + end + process :redirect_to_named_route + assert_redirected_to 'http://test.host/route_one' + assert_redirected_to route_one_url + assert_redirected_to :route_one end end - + + def test_assert_redirect_to_named_route_failure + with_routing do |set| + set.draw do + set.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'one' + set.route_two 'route_two', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two' + set.connect ':controller/:action/:id' + end + process :redirect_to_named_route + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to 'http://test.host/route_two' + end + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two' + end + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to route_two_url + end + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to :route_two + end + end + end + # test the flash-based assertions with something is in the flash def test_flash_assertions_full process :flash_me @@ -321,7 +350,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_flash_equal 'my name is inigo montoya...', 'hello' end - # check if we were rendered by a file-based template? def test_rendered_action process :nothing |