In my routes file I have:
resources :subscription, :only => [:show], :constraints => {:protocol => "https"}
I'm trying to add a spec for this route like this:
it "recognizes and generates #show" do
{ :get => "/subscription", :protocol => 'https' }.should route_to(:controller => "subscriptions", :action => "show")
end
However, the spec still fails.
If I remove the :protocol => 'https'
, the spec also fails:
ActionController::RoutingError: No route matches "/subscription"
The (undocumented?) solution is to simply include an entire dummy url, like so:
it "recognizes and generates #show" do
{ :get => "https://test.host/subscription" }.should route_to(:controller => "subscriptions", :action => "show")
end
I figured it out from this ticket and this changeset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With