BigW Consortium Gitlab

db_cleaner.rb 574 Bytes
Newer Older
1
RSpec.configure do |config|
2 3 4
  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
  end
5

6 7 8 9
  config.append_after(:context) do
    DatabaseCleaner.clean_with(:truncation)
  end

10
  config.before(:each) do
11 12 13
    DatabaseCleaner.strategy = :transaction
  end

14
  config.before(:each, js: true) do
15
    DatabaseCleaner.strategy = :truncation
16 17
  end

18 19 20 21
  config.before(:each, truncate: true) do
    DatabaseCleaner.strategy = :truncation
  end

22 23 24 25
  config.before(:each) do
    DatabaseCleaner.start
  end

26
  config.append_after(:each) do
27
    DatabaseCleaner.clean
28 29
  end
end