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:
Diffstat (limited to 'spec/workers/bulk_imports/export_request_worker_spec.rb')
-rw-r--r--spec/workers/bulk_imports/export_request_worker_spec.rb29
1 files changed, 21 insertions, 8 deletions
diff --git a/spec/workers/bulk_imports/export_request_worker_spec.rb b/spec/workers/bulk_imports/export_request_worker_spec.rb
index cb280c6d263..f838bff528c 100644
--- a/spec/workers/bulk_imports/export_request_worker_spec.rb
+++ b/spec/workers/bulk_imports/export_request_worker_spec.rb
@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe BulkImports::ExportRequestWorker do
let_it_be(:bulk_import) { create(:bulk_import) }
let_it_be(:config) { create(:bulk_import_configuration, bulk_import: bulk_import) }
- let_it_be(:entity) { create(:bulk_import_entity, source_full_path: 'foo/bar', bulk_import: bulk_import) }
let_it_be(:version_url) { 'https://gitlab.example/api/v4/version' }
let(:response_double) { double(code: 200, success?: true, parsed_response: {}) }
@@ -20,16 +19,30 @@ RSpec.describe BulkImports::ExportRequestWorker do
allow(Gitlab::HTTP).to receive(:post).and_return(response_double)
end
- include_examples 'an idempotent worker' do
- it 'requests relations export' do
- expected = "/groups/foo%2Fbar/export_relations"
+ shared_examples 'requests relations export for api resource' do
+ include_examples 'an idempotent worker' do
+ it 'requests relations export' do
+ expect_next_instance_of(BulkImports::Clients::HTTP) do |client|
+ expect(client).to receive(:post).with(expected).twice
+ end
- expect_next_instance_of(BulkImports::Clients::HTTP) do |client|
- expect(client).to receive(:post).with(expected).twice
+ perform_multiple(job_args)
end
-
- perform_multiple(job_args)
end
end
+
+ context 'when entity is group' do
+ let(:entity) { create(:bulk_import_entity, :group_entity, source_full_path: 'foo/bar', bulk_import: bulk_import) }
+ let(:expected) { '/groups/foo%2Fbar/export_relations'}
+
+ include_examples 'requests relations export for api resource'
+ end
+
+ context 'when entity is project' do
+ let(:entity) { create(:bulk_import_entity, :project_entity, source_full_path: 'foo/bar', bulk_import: bulk_import) }
+ let(:expected) { '/projects/foo%2Fbar/export_relations' }
+
+ include_examples 'requests relations export for api resource'
+ end
end
end