diff options
Diffstat (limited to 'spec/workers/bulk_import_worker_spec.rb')
-rw-r--r-- | spec/workers/bulk_import_worker_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/workers/bulk_import_worker_spec.rb b/spec/workers/bulk_import_worker_spec.rb index 205bf23f36d..b67c5c62f76 100644 --- a/spec/workers/bulk_import_worker_spec.rb +++ b/spec/workers/bulk_import_worker_spec.rb @@ -84,17 +84,20 @@ RSpec.describe BulkImportWorker do expect { subject.perform(bulk_import.id) } .to change(BulkImports::Tracker, :count) - .by(BulkImports::Stage.pipelines.size * 2) + .by(BulkImports::Groups::Stage.pipelines.size * 2) expect(entity_1.trackers).not_to be_empty expect(entity_2.trackers).not_to be_empty end context 'when there are created entities to process' do - it 'marks a batch of entities as started, enqueues EntityWorker, ExportRequestWorker and reenqueues' do + let_it_be(:bulk_import) { create(:bulk_import, :created) } + + before do stub_const("#{described_class}::DEFAULT_BATCH_SIZE", 1) + end - bulk_import = create(:bulk_import, :created) + it 'marks a batch of entities as started, enqueues EntityWorker, ExportRequestWorker and reenqueues' do create(:bulk_import_entity, :created, bulk_import: bulk_import) create(:bulk_import_entity, :created, bulk_import: bulk_import) @@ -106,6 +109,16 @@ RSpec.describe BulkImportWorker do expect(bulk_import.entities.map(&:status_name)).to contain_exactly(:created, :started) end + + context 'when there are project entities to process' do + it 'does not enqueue ExportRequestWorker' do + create(:bulk_import_entity, :created, :project_entity, bulk_import: bulk_import) + + expect(BulkImports::ExportRequestWorker).not_to receive(:perform_async) + + subject.perform(bulk_import.id) + end + end end context 'when exception occurs' do |