Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-23 18:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-23 18:08:42 +0300
commit9086e66ee72527839053ec6db19ed321a3b3a61b (patch)
treef2904493d8539228823f15cf4126eb8c4ffa79e3 /spec/workers/bulk_import_worker_spec.rb
parentb17c74a7e2cf516ed189e525291cb096411b7ac5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/bulk_import_worker_spec.rb')
-rw-r--r--spec/workers/bulk_import_worker_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/workers/bulk_import_worker_spec.rb b/spec/workers/bulk_import_worker_spec.rb
new file mode 100644
index 00000000000..862dbce3177
--- /dev/null
+++ b/spec/workers/bulk_import_worker_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe BulkImportWorker do
+ let!(:bulk_import) { create(:bulk_import, :started) }
+ let!(:entity) { create(:bulk_import_entity, bulk_import: bulk_import) }
+ let(:importer) { double(execute: nil) }
+
+ subject { described_class.new }
+
+ describe '#perform' do
+ before do
+ allow(BulkImports::Importers::GroupImporter).to receive(:new).and_return(importer)
+ end
+
+ it 'executes Group Importer' do
+ expect(importer).to receive(:execute)
+
+ subject.perform(bulk_import.id)
+ end
+
+ it 'updates bulk import and entity state' do
+ subject.perform(bulk_import.id)
+
+ expect(bulk_import.reload.human_status_name).to eq('finished')
+ expect(entity.reload.human_status_name).to eq('finished')
+ end
+
+ context 'when bulk import could not be found' do
+ it 'does nothing' do
+ expect(bulk_import).not_to receive(:top_level_groups)
+ expect(bulk_import).not_to receive(:finish!)
+
+ subject.perform(non_existing_record_id)
+ end
+ end
+ end
+end