# Routing spec problem after updating to rSpec 1.2.2

**URL:** <https://www.ruby-forum.com/t/routing-spec-problem-after-updating-to-rspec-1-2-2/163789>\
**Category:** Rails\
**Created:** [March 24, 2009, 9:47pm UTC](https://www.ruby-forum.com/t/routing-spec-problem-after-updating-to-rspec-1-2-2/163789 "2009-03-24T21:47:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlwinter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecccb3/32.png) [@rlwinter](https://www.ruby-forum.com/u/rlwinter)\
**Post date:** [March 24, 2009, 9:47pm UTC](https://www.ruby-forum.com/t/routing-spec-problem-after-updating-to-rspec-1-2-2/163789/1 "2009-03-24T21:47:40Z")

</div>

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  
stupid.

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”  
end  
end  
end

getting this failure:

1. 

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”}\>  
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action\_controller/test\_case.rb:114:in  
`clean\_backtrace’  
./spec/controllers/sessions\_controller\_spec.rb:104:

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”,  
:controller=\>“sessions”}  
PUT /session(.:format) {:action=\>“update”,  
:controller=\>“sessions”}  
DELETE /session(.:format) {:action=\>“destroy”,  
:controller=\>“sessions”}  
POST /session(.:format) {:action=\>“create”,  
:controller=\>“sessions”}

Can anyone explain this? Thanks.

---

<div class="post-metadata">

**Author:** ![rlwinter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecccb3/32.png) [@rlwinter](https://www.ruby-forum.com/u/rlwinter)\
**Post date:** [March 26, 2009, 10:09am UTC](https://www.ruby-forum.com/t/routing-spec-problem-after-updating-to-rspec-1-2-2/163789/2 "2009-03-26T10:09:12Z")

</div>

Hey Robert,

I just posted a fix to this on my blog:  
[http://www.aquabu.com/2009/3/26/restful\_authentication-and-rspec-rails](http://www.aquabu.com/2009/3/26/restful_authentication-and-rspec-rails)

Also, see this post by David C.:  
[http://www.nabble.com/route\_for-td22406472.html](http://www.nabble.com/route_for-td22406472.html)

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  
quoted.

Best,  
Noah

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](mailto:removed_email_address@domain.invalid)
