-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoking database cleaner between retries #29
Comments
there is no current api exposed for this functionality, see #33 if you want to add it! |
If you put DatabaseCleaner in before/after hooks instead of an around hook then your db will get cleaned between retries. My rspec config looks something like this: config.before(:each) do |example|
DatabaseCleaner.start
end
config.after(:each) do |example|
Capybara.reset_sessions! if example.metadata[:js]
DatabaseCleaner.clean
end
config.around(:each) do |example|
if example.metadata[:js]
example.run_with_retry retry: 3
else
example.run
end
end If you're using Capybara you will need to call Capybara.reset_sessions! before cleaning the database in the after hook. |
Came across this and it should be helpful to leave my findings. Unlike what's said above, Check your |
We have a flaky test suite of >2500 tests that invokes DatabaseCleaner between tests. Despite having a retry count of 3, we're seeing issues like unique constraint violated and record already exists...
Is there a way to explicitly invoke DatabaseCleaner between each retry attempt?
The text was updated successfully, but these errors were encountered: