[rspec-users] Should I use cucumber or Controller RSpecs or both?

Cathal Curtis lists at ruby-forum.com
Mon Feb 13 17:46:16 EST 2012


Hi All,

I'd like to get some other's opinions on testing controllers.

Say I have a model and I want to prevent deletion of instances of it.
The controllers's destroy action simply redirects to an error page -
nothing else.
Lets assume the relevant views have no links or buttons to delete the
instance.
I want to ensure that on receipt of a DELETE request for an instance of
that model, that the application does in fact disallow the deletion and
redirects to an error page.

Should I create a cucumber test, with a step that would call something
like: "delete url_for(...)"?
Or should I leave it to a Controller RSpec?

I have implemented both, the RSpec is working fine but I'm having
trouble getting cucumber to follow the redirect and therefore my "Then I
should be on error page" fails.

I'd like to know if such a cucumber test is unnecessary.
Should I even have such a cucumber test if the user cannot generate the
condition/action/event through normal use of the application?
If the controller RSpec proves that the controller responds with a
redirect response to the correct page, is that all I need?

Thanks in advance, Cathal.

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list