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

Cynthia Kiser cnk at ugcs.caltech.edu
Mon Feb 13 22:56:48 EST 2012

Quoting Cathal Curtis <lists at ruby-forum.com>:
> 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'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?

In my opinion, if the user can't generate the event through normal
interaction (clicking links, etc.) then it probably shouldn't be in a
cucumber test.

> If the controller RSpec proves that the controller responds with a
> redirect response to the correct page, is that all I need?

Yes. The two tests are trying to test the same thing and so are mostly
redundant. But I think the RSpec test is the more appropriate
test. It's a bonus that that one is already working.
Cynthia N. Kiser
cnk at ugcs.caltech.edu

More information about the rspec-users mailing list