I want to write tests for destroying objects on ruby on rails with cucumber and capybara and rack_test.
I think that I should write a scenario like:
When I try to delete X object
Then I should be on the index page for ...
And I should see "Object deleted successfully"
I don't want to test it by clicking on a link on the index page or the show/edit page because I think I should be testing something different than purely the delete action.
Also, clicking on a link means that the interface is ok, but what happens if someone send a request to delete an object he can't and the interface doesn't show the link?
Given this, I need to send a delete request in the first step and then inspect the response to that request.
I've find troubles trying to do that because when I implement the first step as delete url
then when I try page.should have_contain(text)
I get the error No response yet. Request a page first. (Rack::Test::Error)
What do you think about it?