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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
991 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2018-12-05 23:21:45 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Ci::BuildScheduleWorker do
2018-12-05 23:21:45 +05:30
subject { described_class.new.perform(build.id) }
context 'when build is found' do
context 'when build is scheduled' do
let(:build) { create(:ci_build, :scheduled) }
it 'executes RunScheduledBuildService' do
expect_any_instance_of(Ci::RunScheduledBuildService)
.to receive(:execute).once
subject
end
end
context 'when build is not scheduled' do
let(:build) { create(:ci_build, :created) }
it 'executes RunScheduledBuildService' do
expect_any_instance_of(Ci::RunScheduledBuildService)
.not_to receive(:execute)
subject
end
end
end
context 'when build is not found' do
let(:build) { build_stubbed(:ci_build, :scheduled) }
it 'does nothing' do
expect_any_instance_of(Ci::RunScheduledBuildService)
.not_to receive(:execute)
subject
end
end
end