Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1971

Show
Ignore:
Timestamp:
08/06/05 08:37:25 (3 years ago)
Author:
minam
Message:

Make assert_redirected_to properly check URL's passed as strings #1910 [Scott Barron]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r1970 r1971  
    11*SVN* 
     2 
     3* Make assert_redirected_to properly check URL's passed as strings #1910 [Scott Barron] 
    24 
    35* Make sure :layout => false is always used when rendering inside a layout 
  • trunk/actionpack/lib/action_controller/assertions.rb

    r1858 r1971  
    7979          end.flatten 
    8080 
    81           if eurl && url then assert_equal(eurl, url, msg) 
    82           else assert_equal(epath, path, msg) 
    83           end 
     81          assert_equal(eurl, url, msg) if eurl && url 
     82          assert_equal(epath, path, msg) if epath && path  
    8483        else 
    8584          msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>)", 
  • trunk/actionpack/test/controller/action_pack_assertions_test.rb

    r1915 r1971  
    2121 
    2222  def redirect_to_path() redirect_to '/some/path' end 
     23 
     24  def redirect_to_named_route() redirect_to route_one_url end 
    2325   
    2426  # a redirect to an external location 
     
    185187    process :redirect_external 
    186188    assert_redirect_url_match /ruby/ 
     189  end 
     190 
     191  # test the redirection to a named route 
     192  def test_assert_redirect_to_named_route 
     193    process :redirect_to_named_route 
     194    assert_raise(Test::Unit::AssertionFailedError) do 
     195      assert_redirected_to 'http://test.host/route_two' 
     196    end 
    187197  end 
    188198   
  • trunk/actionpack/test/controller/fake_controllers.rb

    r1837 r1971  
    2020 
    2121ActionController::Routing::Routes.draw do |map| 
     22  map.route_one 'route_one', :controller => 'elsewhere', :action => 'flash_me' 
    2223  map.connect ':controller/:action/:id' 
    2324end