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

bulk_import_worker_spec.rb « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8b73549e071c392099fe5b8901676b0152e89655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#  frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImportWorker, feature_category: :importers do
  let_it_be(:bulk_import) { create(:bulk_import) }
  let_it_be(:job_args) { [bulk_import.id] }

  describe '#perform' do
    it 'executes the BulkImports::ProcessService' do
      expect_next_instance_of(BulkImports::ProcessService) do |process_service|
        expect(process_service).to receive(:execute)
      end

      described_class.new.perform(bulk_import.id)
    end

    context 'when no BulkImport is found' do
      let(:job_args) { nil }

      it 'returns without error' do
        expect { described_class.new.perform(bulk_import.id) }.not_to raise_error
      end

      it 'does not executes the BulkImports::ProcessService' do
        expect_any_instance_of(BulkImports::ProcessService) do |process_service|
          expect(process_service).not_to receive(:execute)
        end
      end
    end
  end
end