Reputation: 19969
I'd like to pass a named variable in my rspec call to match
this is the route:
match '/api/get-pairings/:global_id' => 'api#get_pairings', :as => :get_pairings
this is what I have but doesn't work:
it "should get pairings for a specific id" do
{:get => get_pairings_path, :global_id => 1000 }.should route_to(:controller => "api", :action => "get_pairings")
{:get => get_pairings_path, :params => { :global_id => 1000 } }.should route_to(:controller => "api", :action => "get_pairings")
end
Any ideas?
thx in advance
Upvotes: 0
Views: 89
Reputation: 27374
You need to pass the variable to the _path
method for the specs to work:
it "should get pairings for a specific id" do
{:get => get_pairings_path(:global_id => 1000) }.
should route_to(:controller => "api",
:action => "get_pairings",
:global_id => "1000")
end
Upvotes: 1