From 58cd495859c92c9eb637c3453bd82808c0848dc9 Mon Sep 17 00:00:00 2001 From: Helge Rausch Date: Mon, 25 Jul 2022 11:02:32 +0200 Subject: [PATCH] Run DatabaseCleaner before RSpec tests (#539) * Rename workflow * Run DatabaseCleaner before RSpec tests * Run on all pushes --- .github/workflows/{test.yml => build.yml} | 7 +++---- spec/spec_helper.rb | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) rename .github/workflows/{test.yml => build.yml} (95%) diff --git a/.github/workflows/test.yml b/.github/workflows/build.yml similarity index 95% rename from .github/workflows/test.yml rename to .github/workflows/build.yml index e65b7788..46606220 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/build.yml @@ -8,13 +8,12 @@ name: Ruby on: - push: - branches: [ master ] + push: {} pull_request: - branches: [ master ] + branches: [master] jobs: - test: + tests: runs-on: ubuntu-latest services: postgres: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9513fd0e..1c8b987b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -53,6 +53,10 @@ config.infer_spec_type_from_file_location! + config.before(:suite) do + DatabaseCleaner.clean_with(:truncation, except: %w(achievements)) + end + config.before(:example) do DatabaseCleaner.strategy = :transaction end