On Wed, Sep 10, 2008 at 1:24 PM, Mark Dodwell <[EMAIL PROTECTED]> wrote:
> It seems that RSpec-Rails isn't restricted to the HTTP methods
> correctly.
>
> For example doing:
>
>   http://foo.local/session/destroy
>
> in the browser doesn't work, because the destroy action is only
> recognised with the HTTP 'delete' verb.
>
> But in Rspec specs if you do:
>
>  get :destroy
>
> It works.
>
> Is this intended behaviour or a bug?

Rails uses routing to map DELETE /session to
SessionController#destroy.  Controller specs don't use routing.
Whenever you do get/put/post/delete in your spec, you're effectively
doing

SessionController.new.destroy

except you can't simply do that, because ActionPack is a rat's nest of
dependencies.

Pat
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to