From d7dc9ad154b2589b6a1b702d76d29be4480d1211 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 27 Mar 2018 19:04:57 -0700 Subject: [PATCH] Clean the test path after each spec run FactoryBot's build_stubbed ignores the current database sequence of the projects table and starts at ID 1000. If more than 1000 projects are created during a test run, leftover repositories can cause spec failures. For example, a spec that expects an empty repository may fail since there may be existing content. Closes #5461 --- spec/spec_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5051cd34564..e8cecf361ff 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -97,6 +97,10 @@ RSpec.configure do |config| TestEnv.init end + config.after(:all) do + TestEnv.clean_test_path + end + config.before(:example) do # Skip pre-receive hook check so we can use the web editor and merge. allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])