debian-mirror-gitlab/spec/lib/gitlab/ci/status/build/manual_spec.rb

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

49 lines
1.2 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Ci::Status::Build::Manual do
2022-06-21 17:19:12 +05:30
let_it_be(:user) { create(:user) }
let_it_be(:job) { create(:ci_build, :manual) }
2018-05-09 12:01:36 +05:30
subject do
2022-06-21 17:19:12 +05:30
described_class.new(Gitlab::Ci::Status::Core.new(job, user))
2018-05-09 12:01:36 +05:30
end
describe '#illustration' do
it { expect(subject.illustration).to include(:image, :size, :title, :content) }
2022-06-21 17:19:12 +05:30
context 'when the user can trigger the job' do
before do
job.project.add_maintainer(user)
end
it { expect(subject.illustration[:content]).to match /This job requires manual intervention to start/ }
end
context 'when the user can not trigger the job' do
it { expect(subject.illustration[:content]).to match /This job does not run automatically and must be started manually/ }
end
2018-05-09 12:01:36 +05:30
end
describe '.matches?' do
2022-08-27 11:52:29 +05:30
subject { described_class.matches?(build, user) }
2018-05-09 12:01:36 +05:30
context 'when build is manual' do
let(:build) { create(:ci_build, :manual) }
it 'is a correct match' do
expect(subject).to be true
end
end
context 'when build is not manual' do
let(:build) { create(:ci_build) }
it 'does not match' do
expect(subject).to be false
end
end
end
end