2016-10-14 10:53:51 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe BuildFinishedWorker do
|
|
|
|
describe '#perform' do
|
|
|
|
context 'when build exists' do
|
2017-08-23 09:46:10 +00:00
|
|
|
let!(:build) { create(:ci_build) }
|
2016-10-14 10:53:51 +00:00
|
|
|
|
|
|
|
it 'calculates coverage and calls hooks' do
|
2018-02-05 16:52:46 +00:00
|
|
|
expect(BuildTraceSectionsWorker)
|
2016-10-14 10:53:51 +00:00
|
|
|
.to receive(:new).ordered.and_call_original
|
2018-02-05 16:52:46 +00:00
|
|
|
expect(BuildCoverageWorker)
|
2016-10-14 10:53:51 +00:00
|
|
|
.to receive(:new).ordered.and_call_original
|
|
|
|
|
2018-02-05 16:52:46 +00: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 12:40:50 +00:00
|
|
|
expect(ArchiveTraceWorker).to receive(:perform_async)
|
2016-10-14 10:53:51 +00: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
|