2016-10-14 06:53:51 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe BuildFinishedWorker do
|
|
|
|
describe '#perform' do
|
|
|
|
context 'when build exists' do
|
2017-08-23 05:46:10 -04:00
|
|
|
let!(:build) { create(:ci_build) }
|
2016-10-14 06:53:51 -04:00
|
|
|
|
|
|
|
it 'calculates coverage and calls hooks' do
|
2018-02-05 11:52:46 -05:00
|
|
|
expect(BuildTraceSectionsWorker)
|
2016-10-14 06:53:51 -04:00
|
|
|
.to receive(:new).ordered.and_call_original
|
2018-02-05 11:52:46 -05:00
|
|
|
expect(BuildCoverageWorker)
|
2016-10-14 06:53:51 -04:00
|
|
|
.to receive(:new).ordered.and_call_original
|
|
|
|
|
2018-02-05 11:52:46 -05:00
|
|
|
expect_any_instance_of(BuildTraceSectionsWorker).to receive(:perform)
|
|
|
|
expect_any_instance_of(BuildCoverageWorker).to receive(:perform)
|
|
|
|
expect(BuildHooksWorker).to receive(:perform_async)
|
2018-03-06 07:40:50 -05:00
|
|
|
expect(ArchiveTraceWorker).to receive(:perform_async)
|
2016-10-14 06:53:51 -04:00
|
|
|
|
|
|
|
described_class.new.perform(build.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when build does not exist' do
|
|
|
|
it 'does not raise exception' do
|
|
|
|
expect { described_class.new.perform(123) }
|
|
|
|
.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|