At first, I verified that
capybara is in my
It also has to be loaded by
RSpec, so I required it in
When I ran the test, Capybara opened a new Firefox window and did my defined steps as expected.
To use PhantomJS with Capybara, you have to switch to another adapter. There is an adapter called Poltergeist which enables you to use PhantomJS. So I went on and added Poltergeist to my Gemfile.
As soon as I required
capybara/poltergeist and added
To solve this, you can use
DatabaseCleaner with the truncation strategy instead of transactions.
But there is a caveat, the truncation strategy is slower.
As I like my tests run fast, I wrote the following RSpec configuration which just enables the truncation strategy
for tests with
js: true set.
Note, that I also moved
After this, I just had to disable the default transactional feature in
All the code above can also be found in a gist.