From bce00bad77306954682316a1823f51df07a8228f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 17 Feb 2017 16:19:39 +0100 Subject: Truncate the DB in after(:all) test for Gitlab::ImportExport::ProjectTreeRestorer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/lib/gitlab/import_export/project_tree_restorer_spec.rb | 6 +----- spec/support/db_cleaner.rb | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index 94a3b0fbba9..f4a21c24fa1 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -3,7 +3,7 @@ include ImportExport::CommonUtil describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do describe 'restore project tree' do - before(:all) do + before(:context) do @user = create(:user) RSpec::Mocks.with_temporary_scope do @@ -15,10 +15,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do end end - after(:all) do - @user.destroy! - end - context 'JSON' do it 'restores models based on JSON' do expect(@restored_project_json).to be true diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb index 247f0954221..6f31828b825 100644 --- a/spec/support/db_cleaner.rb +++ b/spec/support/db_cleaner.rb @@ -3,6 +3,10 @@ RSpec.configure do |config| DatabaseCleaner.clean_with(:truncation) end + config.append_after(:context) do + DatabaseCleaner.clean_with(:truncation) + end + config.before(:each) do DatabaseCleaner.strategy = :transaction end -- cgit v1.2.1