[rspec-users] Should I use cucumber or Controller RSpecs or both?
jko170 at gmail.com
Mon Feb 13 22:57:49 EST 2012
On Feb 13, 2012, at 3:46 PM, Cathal Curtis wrote:
> 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
> 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/.
> rspec-users mailing list
> rspec-users at rubyforge.org
Some good discussion on this topic: http://solnic.eu/2012/02/02/yes-you-should-write-controller-tests.html
More information about the rspec-users