我想在我的rspec调用中传递一个命名变量来匹配
这是路由:
match '/api/get-pairings/:global_id' => 'api#get_pairings', :as => :get_pairings这是我所拥有的,但不起作用:
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有什么想法吗?
提前进行thx
发布于 2012-09-25 09:28:19
您需要将变量传递给_path方法,才能使规范生效:
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")
endhttps://stackoverflow.com/questions/12574754
复制相似问题