How to use rspec to test named routes?

routes, rspec, ruby, ruby-on-rails

Solution

If this is in a controller spec, you can call the routing method directly, no helper needed.

describe SomeController do
  it 'should recognize ma routes!' do
   thing_path(23).should == '/things/23'
  end
end

Problem

Given I have a named route: ``` map.some_route '/some_routes/:id', :controller => 'some', :action => 'other' ``` How do I use the routing spec file 'spec/routing/some_routing_spec.rb' to test for that named route? I've tried this after the "describe SomeRouteController" block and it doesn't work, I get 'undefined method "helper": ``` describe SomeRouteHelper, 'some routes named routes' do it 'should recognize some_route' do helper.some_route_path(23).should == '/some_routes/23' end end ```

Original source