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

Changeset 8748

Show
Ignore:
Timestamp:
01/30/08 01:25:44 (7 months ago)
Author:
nzkoz
Message:

Make assert_routing aware of the HTTP method used. Closes #8039 [mpalmer]

Files:

Legend:

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

    r8738 r8748  
    11*SVN* 
     2 
     3* Make assert_routing aware of the HTTP method used.  #8039 [mpalmer] 
     4  e.g. assert_routing({ :method => 'put', :path => '/product/321' }, { :controller => "product", :action => "update", :id => "321" }) 
    25 
    36* Make map.root accept a single symbol as an argument to declare an alias.  #10818 [bscofield]  
  • trunk/actionpack/lib/action_controller/assertions/routing_assertions.rb

    r8300 r8748  
    115115      #  # Tests a route, providing a defaults hash 
    116116      #  assert_routing 'controller/action/9', {:id => "9", :item => "square"}, {:controller => "controller", :action => "action"}, {}, {:item => "square"} 
     117      # 
     118      #  # Tests a route with a HTTP method 
     119      #  assert_routing({ :method => 'put', :path => '/product/321' }, { :controller => "product", :action => "update", :id => "321" }) 
    117120      def assert_routing(path, options, defaults={}, extras={}, message=nil) 
    118121        assert_recognizes(options, path, extras, message) 
     
    123126        end 
    124127          
    125         assert_generates(path, options, defaults, extras, message) 
     128        assert_generates(path.is_a?(Hash) ? path[:path] : path, options, defaults, extras, message) 
    126129      end 
    127130 
  • trunk/actionpack/test/controller/test_test.rb

    r8570 r8748  
    375375  end 
    376376 
     377  def test_assert_routing_with_method 
     378    with_routing do |set| 
     379        set.draw { |map| map.resources(:content) } 
     380      assert_routing({ :method => 'post', :path => 'content' }, { :controller => 'content', :action => 'create' }) 
     381    end 
     382  end 
     383 
    377384  def test_assert_routing_in_module 
    378385    assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'