Forum: Ruby on Rails Routing spec problem after updating to rSpec 1.2.2

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Robert W. (Guest)
on 2009-03-24 22:47
Hi all,

Before going forward with some sort of bug report to the rSpec guys I
wanted to run this past you guys to make sure I'm not doing something

I have this resource (this is actually from restful_authentication):

  map.resource :session

with this spec:

describe SessionsController do
  describe "route generation" do
    it "should route the create sessions correctly" do
      route_for(:controller => 'sessions', :action => 'create').should
== "/session"

getting this failure:

Test::Unit::AssertionFailedError in 'SessionsController route generation
should route the create sessions correctly'
The recognized options <{"action"=>"show", "controller"=>"sessions"}>
did not match <{"action"=>"create", "controller"=>"sessions"}>,
difference: <{"action"=>"create"}>

Line 104 of sessions_controller_spec.rb is the route_for line above.

The routes related to session look like:

session GET    /session(.:format)      {:action=>"show",
               PUT    /session(.:format)     {:action=>"update",
               DELETE /session(.:format)  {:action=>"destroy",
               POST   /session(.:format)   {:action=>"create",

Can anyone explain this? Thanks.
Noah Thorp (Guest)
on 2009-03-26 11:09
(Received via mailing list)
Hey Robert,

I just posted a fix to this on my blog:

Also, see this post by David C.:

Essentially you need to change your should == match to be a hash which
includes a :method key. Also, numbers for the :id param should be


Basically you need to change the format of your specs to hashes where
you are using puts and deletes:

On Mar 24, 1:47 pm, Robert W. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.