[rspec-users] route_to to test root route

Amiruddin Nagri amir.nagri at gmail.com
Wed Sep 29 01:44:13 EDT 2010

I am working on a Rails 3 application using RSPec 2.beta.20.

I am having the following routes in my routes.rb

resources :projects
root :to => 'projects#index'

I am trying to test both the routes. But while testing root route I am
getting a failure :

it 'should route root to projects#index' do
  {:get => '/'}.should route_to(:controller => 'projects', :action =>

But the above example is failing since route_to is expecting a route like
'/projects'. Is there a way to test root routes which are also configured
elsewhere in the routes.rb.

Amiruddin Nagri,
Bangalore, 560008, KA

Y! IM : amir_nagri at yahoo.com
GTalk : amir.nagri at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100929/3ecbd74e/attachment.html>

More information about the rspec-users mailing list