diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/lib/bulk_imports/importers | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/bulk_imports/importers')
-rw-r--r-- | spec/lib/bulk_imports/importers/group_importer_spec.rb | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/spec/lib/bulk_imports/importers/group_importer_spec.rb b/spec/lib/bulk_imports/importers/group_importer_spec.rb index 95ac5925c97..95dca7fc486 100644 --- a/spec/lib/bulk_imports/importers/group_importer_spec.rb +++ b/spec/lib/bulk_imports/importers/group_importer_spec.rb @@ -18,12 +18,12 @@ RSpec.describe BulkImports::Importers::GroupImporter do subject { described_class.new(bulk_import_entity) } before do + allow(Gitlab).to receive(:ee?).and_return(false) allow(BulkImports::Pipeline::Context).to receive(:new).and_return(context) - stub_http_requests end describe '#execute' do - it "starts the entity and run its pipelines" do + it 'starts the entity and run its pipelines' do expect(bulk_import_entity).to receive(:start).and_call_original expect_to_run_pipeline BulkImports::Groups::Pipelines::GroupPipeline, context: context expect_to_run_pipeline BulkImports::Groups::Pipelines::SubgroupEntitiesPipeline, context: context @@ -32,6 +32,18 @@ RSpec.describe BulkImports::Importers::GroupImporter do expect(bulk_import_entity.reload).to be_finished end + + context 'when failed' do + let(:bulk_import_entity) { create(:bulk_import_entity, :failed, bulk_import: bulk_import) } + + it 'does not transition entity to finished state' do + allow(bulk_import_entity).to receive(:start!) + + subject.execute + + expect(bulk_import_entity.reload).to be_failed + end + end end def expect_to_run_pipeline(klass, context:) @@ -39,18 +51,4 @@ RSpec.describe BulkImports::Importers::GroupImporter do expect(pipeline).to receive(:run).with(context) end end - - def stub_http_requests - double_response = double( - code: 200, - success?: true, - parsed_response: {}, - headers: {} - ) - - allow_next_instance_of(BulkImports::Clients::Http) do |client| - allow(client).to receive(:get).and_return(double_response) - allow(client).to receive(:post).and_return(double_response) - end - end end |