2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe ::Ci::PipelineArtifacts::CoverageReportWorker do
|
2020-11-24 15:15:51 +05:30
|
|
|
describe '#perform' do
|
|
|
|
subject { described_class.new.perform(pipeline_id) }
|
|
|
|
|
|
|
|
context 'when pipeline exists' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline) }
|
|
|
|
let(:pipeline_id) { pipeline.id }
|
|
|
|
|
|
|
|
it 'calls pipeline report result service' do
|
2021-03-08 18:12:59 +05:30
|
|
|
expect_next_instance_of(::Ci::PipelineArtifacts::CoverageReportService) do |create_artifact_service|
|
2020-11-24 15:15:51 +05:30
|
|
|
expect(create_artifact_service).to receive(:execute)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline does not exist' do
|
|
|
|
let(:pipeline_id) { non_existing_record_id }
|
|
|
|
|
|
|
|
it 'does not call pipeline create artifact service' do
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(Ci::PipelineArtifacts::CoverageReportService).not_to receive(:execute)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|