If you want to spec out your routes you'll need:
#console $ mkdir ./spec/routing $ touch ./spec/routing/users_spec.rb
Let's say you have this in routes.rb
:
#./config/routes.rb ⋮ get "users/:id" => 'users#show' ⋮
In your routing spec you'll want to make sure you are testing numeric :id
values as strings since that's what they really are in this instance.
#./spec/routing/users_spec.rb require 'spec_helper' describe "routing to users" do it "routes /users/:id to users#show for id" do { :get => "/users/42" } .should route_to(:controller => "users", :action => "show", :id => "42") end it "should not expose all users" do { :get => "/users" }.should_not be_routable end end
Meaning if you did the following:
#./spec/routing/users_spec.rb ⋮ { :get => "/users/42" }.should route_to(:controller => "users", :action => "show", :id => 42) ⋮
... its going to keep failing and you may resort to testing routes you know that work the same exact way and then you will be driven further and further from sanity.