我有以下rspec路由規範,但我需要在帖子中指定:defaults => { :format => 'json' }
;我將如何做到這一點?在路由規範中指定默認格式
規格:
it "should route to all-locations-nav" do
{:post => locations_nav_path }.should route_to(:controller => "api", :action => "locations_nav")
end
編輯#1
如此玩弄,它看起來像這樣修復它:
it "should route to all-locations-nav" do
{:post => locations_nav_path }.should route_to(:controller => "api", :action => "locations_nav", :format => "json")
end
但如果這是記錄任何地方感到好奇?