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

Changeset 1505

Show
Ignore:
Timestamp:
06/25/05 10:58:44 (3 years ago)
Author:
david
Message:

Updated assert_generates/routing to the new Routes code #1498 [Rick Olson]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/assertions.rb

    r1332 r1505  
    9595      # Asserts that the routing of the given path is handled correctly and that the parsed options match. 
    9696      def assert_recognizes(expected_options, path, extras={}, message=nil) 
     97        path = "/#{path}" unless path[0..0] == '/' 
    9798        # Load routes.rb if it hasn't been loaded. 
    9899        ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?  
     
    106107        extras.each_key { |key| expected_options.delete key } unless extras.nil? 
    107108       
     109        expected_options.stringify_keys! 
    108110        msg = build_message(message, "The recognized options <?> did not match <?>",  
    109111            request.path_parameters, expected_options) 
     
    122124       
    123125        generated_path, found_extras = ActionController::Routing::Routes.generate(options, request) 
    124         generated_path = generated_path.join('/') 
    125126        msg = build_message(message, "found extras <?>, not <?>", found_extras, extras) 
    126127        assert_block(msg) { found_extras == extras } 
  • trunk/actionpack/test/controller/test_test.rb

    r1195 r1505  
    8585                                   :only => { :tag => "li" } } } 
    8686  end 
     87 
     88  def test_assert_routing 
     89    assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5' 
     90  end 
    8791end