debian-mirror-gitlab/spec/workers/ci/pipeline_bridge_status_worker_spec.rb

39 lines
910 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Ci::PipelineBridgeStatusWorker do
2020-03-13 15:44:24 +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 the service' do
service = double('bridge status service')
expect(Ci::PipelineBridgeStatusService)
.to receive(:new)
.with(pipeline.project, pipeline.user)
.and_return(service)
expect(service).to receive(:execute).with(pipeline)
subject
end
end
context 'when pipeline does not exist' do
2020-04-22 19:07:51 +05:30
let(:pipeline_id) { non_existing_record_id }
2020-03-13 15:44:24 +05:30
it 'does not call the service' do
expect(Ci::PipelineBridgeStatusService)
.not_to receive(:new)
subject
end
end
end
end