我的测试示例是:
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
- 导轨 3.2.6
- Rspec (2.10.0)