summaryrefslogtreecommitdiff
path: root/spec/ci/support/db_cleaner.rb
blob: d2d532d9738ad13def8132d23b0ec37497ad7253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# RSpec.configure do |config|

#   config.around(:each) do |example|
#     DatabaseCleaner.strategy = :transaction
#     DatabaseCleaner.clean_with(:truncation)
#     DatabaseCleaner.cleaning do
#       example.run
#     end
#   end

#   config.around(:each, js: true) do |example|
#     DatabaseCleaner.strategy = :truncation
#     DatabaseCleaner.clean_with(:truncation)
#     DatabaseCleaner.cleaning do
#       example.run
#     end
#   end
# end
RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
  end

  config.before(:each, :js => true) do
    DatabaseCleaner.strategy = :truncation
  end

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

  config.after(:each) do
    DatabaseCleaner.clean
  end
end