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:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/workers/bulk_imports/entity_worker_spec.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/workers/bulk_imports/entity_worker_spec.rb')
-rw-r--r--spec/workers/bulk_imports/entity_worker_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/workers/bulk_imports/entity_worker_spec.rb b/spec/workers/bulk_imports/entity_worker_spec.rb
new file mode 100644
index 00000000000..31515b31947
--- /dev/null
+++ b/spec/workers/bulk_imports/entity_worker_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe BulkImports::EntityWorker do
+ describe '#execute' do
+ let(:bulk_import) { create(:bulk_import) }
+
+ context 'when started entity exists' do
+ let(:entity) { create(:bulk_import_entity, :started, bulk_import: bulk_import) }
+
+ it 'executes BulkImports::Importers::GroupImporter' do
+ expect(BulkImports::Importers::GroupImporter).to receive(:new).with(entity).and_call_original
+
+ subject.perform(entity.id)
+ end
+
+ it 'sets jid' do
+ jid = 'jid'
+
+ allow(subject).to receive(:jid).and_return(jid)
+
+ subject.perform(entity.id)
+
+ expect(entity.reload.jid).to eq(jid)
+ end
+ end
+
+ context 'when started entity does not exist' do
+ it 'does not execute BulkImports::Importers::GroupImporter' do
+ entity = create(:bulk_import_entity, bulk_import: bulk_import)
+
+ expect(BulkImports::Importers::GroupImporter).not_to receive(:new)
+
+ subject.perform(entity.id)
+ end
+ end
+ end
+end