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

Ticket #11460: hash_for_method_with_ordered_parameters_test.diff

File hash_for_method_with_ordered_parameters_test.diff, 1.3 kB (added by berpasan, 5 months ago)

Tests hash_for helpers with ordered parameters

  • test/controller/routing_test.rb

    old new  
    15781578      controller.send(:hash_for_show_path, :id => 5) 
    15791579    ) 
    15801580  end 
     1581   
     1582    def test_named_route_hash_access_method_with_ordered_parameters 
     1583    controller = setup_named_route_test 
    15811584 
     1585    assert_equal( 
     1586      { :controller => 'people', :action => 'show', :id => 5, :use_route => :show, :only_path => false }, 
     1587      controller.send(:hash_for_show_url, 5) 
     1588    ) 
     1589    assert_equal( 
     1590      { :controller => 'people', :action => 'show', :id => 5, :use_route => :show, :only_path => true }, 
     1591      controller.send(:hash_for_show_path, 5) 
     1592    ) 
     1593    assert_equal( 
     1594      { :controller => 'people', :action => 'multi', :foo => 5,  
     1595        :bar=> "text", :id=>69, :use_route => :multi, :only_path => false }, 
     1596      controller.send(:hash_for_multi_url, 5, "text", 69) 
     1597    ) 
     1598    assert_equal( 
     1599      { :controller => 'people', :action => 'multi', :foo => 5,  
     1600        :bar=> "text", :id=>69, :use_route => :multi, :only_path => true }, 
     1601      controller.send(:hash_for_multi_path, 5, "text", 69) 
     1602    ) 
     1603 
     1604  end 
     1605 
    15821606  def test_named_route_url_method 
    15831607    controller = setup_named_route_test 
    15841608