在我的路线文件我有:如何在rspec路由规范中指定https协议?
resources :subscription, :only => [:show], :constraints => {:protocol => "https"}
我想添加一个规范的这样这条路线:
it "recognizes and generates #show" do
{ :get => "/subscription", :protocol => 'https' }.should route_to(:controller => "subscriptions", :action => "show")
end
然而,该规范仍然失败。 如果我删除:protocol => 'https'
,该规范也将失败:
ActionController::RoutingError: No route matches "/subscription"
为了得到这个工作,我必须指定约束条件为'{protocol =>“https://”}“,而不是简单的”https“',正如人们所期望的那样。 – cfeduke