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/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb')
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb40
1 files changed, 37 insertions, 3 deletions
diff --git a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
index 2279e66720e..2633598b48d 100644
--- a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
@@ -31,7 +31,8 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
'created_at' => '2019-12-26T10:17:14.621Z',
'updated_at' => '2019-12-26T10:17:14.621Z',
'released_at' => '2019-12-26T10:17:14.615Z',
- 'sha' => '901de3a8bd5573f4a049b1457d28bc1592ba6bf9'
+ 'sha' => '901de3a8bd5573f4a049b1457d28bc1592ba6bf9',
+ 'author_id' => user.id
}.merge(attributes)
end
@@ -45,11 +46,11 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
allow_next_instance_of(BulkImports::Common::Extractors::NdjsonExtractor) do |extractor|
allow(extractor).to receive(:extract).and_return(BulkImports::Pipeline::ExtractedData.new(data: [with_index]))
end
-
- pipeline.run
end
it 'imports release into destination project' do
+ pipeline.run
+
expect(project.releases.count).to eq(1)
imported_release = project.releases.last
@@ -62,6 +63,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
expect(imported_release.updated_at.to_s).to eq('2019-12-26 10:17:14 UTC')
expect(imported_release.released_at.to_s).to eq('2019-12-26 10:17:14 UTC')
expect(imported_release.sha).to eq(release['sha'])
+ expect(imported_release.author_id).to eq(release['author_id'])
end
end
@@ -78,6 +80,8 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
let(:attributes) {{ 'links' => [link] }}
it 'restores release links' do
+ pipeline.run
+
release_link = project.releases.last.links.first
aggregate_failures do
@@ -105,6 +109,8 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
let(:attributes) {{ 'milestone_releases' => [{ 'milestone' => milestone }] }}
it 'restores release milestone' do
+ pipeline.run
+
release_milestone = project.releases.last.milestone_releases.first.milestone
aggregate_failures do
@@ -118,5 +124,33 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
end
end
end
+
+ context 'evidences' do
+ it 'creates release evidence' do
+ expect(::Releases::CreateEvidenceWorker).to receive(:perform_async)
+
+ pipeline.run
+ end
+
+ context 'when release is historical' do
+ let(:attributes) {{ 'released_at' => '2018-12-26T10:17:14.621Z' }}
+
+ it 'does not create release evidence' do
+ expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async)
+
+ pipeline.run
+ end
+ end
+
+ context 'when release is upcoming' do
+ let(:attributes) {{ 'released_at' => Time.zone.now + 30.days }}
+
+ it 'does not create release evidence' do
+ expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async)
+
+ pipeline.run
+ end
+ end
+ end
end
end