summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb')
-rw-r--r--spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
index e8cc666605b..06800f7cded 100644
--- a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
+++ b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
@@ -9,16 +9,18 @@ RSpec.shared_examples 'wiki pipeline imports a wiki for an entity' do
let(:extracted_data) { BulkImports::Pipeline::ExtractedData.new(data: {}) }
- context 'successfully imports wiki for an entity' do
- subject { described_class.new(context) }
+ subject { described_class.new(context) }
- before do
- allow_next_instance_of(BulkImports::Common::Extractors::GraphqlExtractor) do |extractor|
- allow(extractor).to receive(:extract).and_return(extracted_data)
- end
+ before do
+ allow_next_instance_of(BulkImports::Common::Extractors::GraphqlExtractor) do |extractor|
+ allow(extractor).to receive(:extract).and_return(extracted_data)
end
+ end
+ context 'when wiki exists' do
it 'imports new wiki into destination project' do
+ expect(subject).to receive(:source_wiki_exists?).and_return(true)
+
expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |repository_service|
url = "https://oauth2:token@gitlab.example/#{entity.source_full_path}.wiki.git"
expect(repository_service).to receive(:fetch_remote).with(url, any_args).and_return 0
@@ -27,5 +29,16 @@ RSpec.shared_examples 'wiki pipeline imports a wiki for an entity' do
subject.run
end
end
+
+ context 'when wiki does not exist' do
+ it 'does not import wiki' do
+ expect(subject).to receive(:source_wiki_exists?).and_return(false)
+
+ expect(parent.wiki).not_to receive(:ensure_repository)
+ expect(parent.wiki.repository).not_to receive(:ensure_repository)
+
+ expect { subject.run }.not_to raise_error
+ end
+ end
end
end