Should I use cucumber or Controller RSpecs or both?

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.

Cathal Curtis wrote in post #1046554:
I found what I think is the answer to my question by chance while doing
some further searching on the web:
http://groups.google.com/group/ruby-capybara/browse_thread/thread/7b6c92e4c96c9135

Jonas N. describes it as using the wrong tool for the job.
Capybara is restricted to what a normal user can do.
And he says it should be tested in a controller test/spec…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs