diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-04-01 17:36:11 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-04-01 17:36:11 +0300 |
commit | 04bb35a4b562fd57b14c55645bb1848a50cdef56 (patch) | |
tree | 1bd1ac2af6a5c088ac2529cdbccceeca402d3ebe /spec/workers/ci/build_prepare_worker_spec.rb | |
parent | ade207e575ab846f6d354aaccc1382a6e512dd0d (diff) | |
parent | b8118a65d595040bfce2d83d5e38dd63ebfedb58 (diff) | |
download | gitlab-ce-04bb35a4b562fd57b14c55645bb1848a50cdef56.tar.gz |
Merge branch 'master' into id-split-self-approval-restrictionsid-split-self-approval-restrictions
Diffstat (limited to 'spec/workers/ci/build_prepare_worker_spec.rb')
-rw-r--r-- | spec/workers/ci/build_prepare_worker_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/workers/ci/build_prepare_worker_spec.rb b/spec/workers/ci/build_prepare_worker_spec.rb new file mode 100644 index 00000000000..9f76696ee66 --- /dev/null +++ b/spec/workers/ci/build_prepare_worker_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +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 |