Hey Robert,
I just posted a fix to this on my blog:
http://www.aquabu.com/2009/3/26/restful_authentication-and-rspec-rails
Also, see this post by David Chelimsky:
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 Walker
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> 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.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---