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
This commit is contained in:
Stan Hu 2018-03-27 19:04:57 -07:00 committed by Toon Claes
parent 092445a402
commit d7dc9ad154
1 changed files with 4 additions and 0 deletions

View File

@ -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])