Routing assertions

Hi

Thanks for help me out

I have two routes :
match ‘admin/categories’ => ‘admin#categories’, :as =>
‘admin_category’
match ‘admin/categories/:sub_category’ => ‘admin#categories’

In rspec


  For first route

    assert_routing({:path => "admin/categories"}, {:controller =>

‘admin’, :action => ‘categories’})

  For second route

     assert_recognizes({:controller=>'admin', :action =>

‘categories’, :sub_category=>‘2’}, ‘admin/categories/2’)

For second route if i am using assert_routing method I am getting
below error

    Failure/Error: assert_routing({:path => "admin/categories/2"},

{:controller => ‘admin’, :action => ‘categories’, :sub_category =>
‘2’})
Test::Unit::AssertionFailedError:
found extras <{:sub_category=>“2”}>, not <{}>

Why assert_routing method is failing for second route? And also let
me know I which scenarios should I use assert_routing,
assert_generates and assert_recognizes?