私のテスト例は次のとおりです。
it "routes to #add_role" do
post("/users/1/add_role").should route_to("users#add_role",id: 1)
end
失敗のメッセージは次のとおりです。
UsersController routing routes to #add_role
Failure/Error: post("/users/1/add_role").should route_to("users#add_role",id: 1)
The recognized options <{"controller"=>"users", "action"=>"add_role", "id"=>"1"}> did not match <{"id"=>1, "controller"=>"users", "action"=>"add_role"}>, difference: <{"id"=>1}>.
<{"id"=>1, "controller"=>"users", "action"=>"add_role"}> expected but was
<{"controller"=>"users", "action"=>"add_role", "id"=>"1"}>.
私の環境:
- ルビー-1.9.3-p194
- Rails 3.2.6
- Rspec(2.10.0)