--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Asserts that the routing of the given <tt>path</tt> was handled correctly and that the parsed options (given in the <tt>expected_options</tt> hash) match <tt>path</tt>. Basically, it asserts that Rails recognizes the route given by <tt>expected_options</tt>.
- !ruby/struct:SM::Flow::P 
  body: Pass a hash in the second argument (<tt>path</tt>) to specify the request method. This is useful for routes requiring a specific HTTP method. The hash should contain a :path with the incoming request path and a :method containing the required HTTP verb.
- !ruby/struct:SM::Flow::VERB 
  body: "  # assert that POSTing to /items will call the create action on ItemsController\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'create'}, {:path =&gt; 'items', :method =&gt; :post}\n"
- !ruby/struct:SM::Flow::P 
  body: "You can also pass in <tt>extras</tt> with a hash containing URL parameters that would normally be in the query string. This can be used to assert that values in the query string string will end up in the params hash correctly. To test query strings you must use the extras argument, appending the query string on the path directly will not work. For example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  # assert that a path of '/items/list/1?view=print' returns the correct options\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'list', :id =&gt; '1', :view =&gt; 'print'}, 'items/list/1', { :view =&gt; &quot;print&quot; }\n"
- !ruby/struct:SM::Flow::P 
  body: The <tt>message</tt> parameter allows you to pass in an error message that is displayed upon failure.
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Examples
- !ruby/struct:SM::Flow::VERB 
  body: "  # Check the default route (i.e., the index action)\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'index'}, 'items'\n\n  # Test a specific action\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'list'}, 'items/list'\n\n  # Test an action with a parameter\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'destroy', :id =&gt; '1'}, 'items/destroy/1'\n\n  # Test a custom route\n  assert_recognizes {:controller =&gt; 'items', :action =&gt; 'show', :id =&gt; '1'}, 'view/item1'\n\n  # Check a Simply RESTful generated route\n  assert_recognizes list_items_url, 'items/list'\n"
full_name: ActionController::Assertions::RoutingAssertions#assert_recognizes
is_singleton: false
name: assert_recognizes
params: (expected_options, path, extras={}, message=nil)
visibility: public
