# frozen_string_literal: true

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.clean_with(:transaction)
    Rails.application.load_seed
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do |example|
    TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js]
    DatabaseCleaner.clean
  end
end

# frozen_string_literal: true

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
    Rails.application.load_seed
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do |example|
    TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js]
    DatabaseCleaner.clean
  end
end

Fix bug in test database preparation
Fix bug in test database preparation

Presumably the intent of this was to clear the database and repopulate
it with seed data. `transaction` isn't the right strategy for this; it
just rolls back any existing transactions.
