2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Ci::Status::Pipeline::Blocked do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:pipeline) { double('pipeline') }
|
|
|
|
|
|
|
|
subject do
|
|
|
|
described_class.new(pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#text' do
|
|
|
|
it 'overrides status text' do
|
|
|
|
expect(subject.text).to eq 'blocked'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#label' do
|
|
|
|
it 'overrides status label' do
|
|
|
|
expect(subject.label).to eq 'waiting for manual action'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.matches?' do
|
|
|
|
let(:user) { double('user') }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
subject { described_class.matches?(pipeline, user) }
|
|
|
|
|
|
|
|
context 'when pipeline is blocked' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, :blocked) }
|
|
|
|
|
|
|
|
it 'is a correct match' do
|
|
|
|
expect(subject).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline is not blocked' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, :success) }
|
|
|
|
|
|
|
|
it 'does not match' do
|
|
|
|
expect(subject).to be false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|