[rspec-users] RSpec in Rails -- HTTP methods
dchelimsky at gmail.com
Wed Sep 10 14:23:17 EDT 2008
On Wed, Sep 10, 2008 at 12:24 PM, Mark Dodwell <lists at ruby-forum.com> wrote:
> It seems that RSpec-Rails isn't restricted to the HTTP methods
> For example doing:
> 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?
RSpec controller examples and scenarios each wrap testing services
provided by Rails. You'll get the same results from rails functional
tests as you do in rspec controller examples, and you'll get the same
results from rails integration tests as you do from rspec scenarios
In controller examples (wrapping rails functional tests), routing is
bypassed, so I think you'll find that you can get, post, put, delete
any action that aren't restricted from the controller.
In RailsStory, the RSpec wrapper for rails integration tests, requests
DO go through routing, so, similarly, I think you'll find that you can
get, post, put, delete any action that aren't restricted from routing.
That all make sense? Let us know if you have any additional questions.
> Many Thanks,
> ~ Mark
> Posted via http://www.ruby-forum.com/.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users