blob: b2c74a920ea1cd3602561da3cea96a31cefc9f91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Ci::BuildPrepareWorker do
subject { described_class.new.perform(build_id) }
context 'build exists' do
let(:build) { create(:ci_build) }
let(:build_id) { build.id }
let(:service) { double(execute: true) }
it 'calls the prepare build service' do
expect(Ci::PrepareBuildService).to receive(:new).with(build).and_return(service)
expect(service).to receive(:execute).once
subject
end
end
context 'build does not exist' do
let(:build_id) { -1 }
it 'does not attempt to prepare the build' do
expect(Ci::PrepareBuildService).not_to receive(:new)
subject
end
end
end
|