My routing specifications for rspec give an incomprehensible error. In the expected v / s parameters, the real id param parameter is in the opposite position. Why and how to solve?
require "spec_helper"
describe GameController do
describe "routing" do
game = FactoryGirl.create(:game)
it "routes to #show" do
get("/game/1").should route_to("game#show", :id => 1)
end
end
end
This causes an error:
1) gameController routing routes to
Failure/Error: get("/game/1").should route_to("game#show", :id => 1)
The recognized options <{"action"=>"show", "controller"=>"game", "id"=>"1"}> did not match <{"id"=>1, "controller"=>"game", "action"=>"show"}>, difference:.
<{"id"=>1, "controller"=>"game", "action"=>"show"}> expected but was
<{"action"=>"show", "controller"=>"game", "id"=>"1"}>.
source
share