JavaScript testing woes with Capybara, RSpec, and poltergeist
I’ve recently started acceptance testing my JavaScript, and it has been something of a rough ride. Using Capybara/RSpec with the poltergeist JS driver, I kept encountering seemingly random failures which nearly forced me to give up on acceptance testing my JS at all. In the end, I managed to work around the issues:
With the help of an excellent post by Avdi Grimm, I installed database_cleaner and configured it to work in the Capybara/poltergeist environment. However, this led to issues where tests didn’t seem to be properly cleaning up after themselves.