My project is using Rails 3 and RSpec and Capybara for testing.
I want to support visitors without javascript, so I’ve added a ‘delete’ member to my resource routes. My non-js links look like /posts/3/delete. These then present a form to the user which then does a post request to the destroy action. I’m using extra javascript to strip off the /delete so that the links still work correctly for those who have it turned on.
The problem I’ve run in to, is that Capybara wants to follow the /posts/3/delete links using an HTTP DELETE request, but it doesn’t support the javascript which strips off the /delete. Is there a way I can tell Capybara to just follow all links with HTTP GET?
While it is not an option you can simply turn on or off yet, this patch is how I ended up solving this for now.
Edit: It appears that this will be changed to work this way in version 2. https://github.com/jnicklas/capybara/issues/184#issuecomment-1940520