Truncate the DB in after(:all) test for Gitlab::ImportExport::ProjectTreeRestorer

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-02-17 16:19:39 +01:00
parent 097924cf05
commit bce00bad77
2 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@ include ImportExport::CommonUtil
describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
describe 'restore project tree' do describe 'restore project tree' do
before(:all) do before(:context) do
@user = create(:user) @user = create(:user)
RSpec::Mocks.with_temporary_scope do RSpec::Mocks.with_temporary_scope do
@ -15,10 +15,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
end end
end end
after(:all) do
@user.destroy!
end
context 'JSON' do context 'JSON' do
it 'restores models based on JSON' do it 'restores models based on JSON' do
expect(@restored_project_json).to be true expect(@restored_project_json).to be true

View file

@ -3,6 +3,10 @@ RSpec.configure do |config|
DatabaseCleaner.clean_with(:truncation) DatabaseCleaner.clean_with(:truncation)
end end
config.append_after(:context) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do config.before(:each) do
DatabaseCleaner.strategy = :transaction DatabaseCleaner.strategy = :transaction
end end