I am using Cucumber to write my integration tests and Database Cleaner to keep my db clean. Everything perfectly works as my tests don't require Javascript.
I can make these last tests pass using Capybara webkit, but then my db is not cleaned at all.
Here is my features/support/env.rb file:
require 'simplecov'
SimpleCov.start 'rails'
require 'cucumber/rails'
Capybara.default_selector = :css
Capybara.javascript_driver = :webkit
begin
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner[:active_record].strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Before do
DatabaseCleaner.start
end
After do |scenario|
DatabaseCleaner.clean
end
I tried something similar to this to check which driver is used by Capybara but it didn't work. I also tried the hack mentioned in the third part of this post but then nothing worked at all...
I really don't know how to achieve this and any help would be greatly appreciated.
Thanks in advance.