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

31 lines
705 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Ci::BuildPrepareWorker do
2019-07-07 11:18:12 +05:30
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