Add specs for an extended blocked pipeline status

This commit is contained in:
Grzegorz Bizon 2017-03-08 11:44:36 +01:00
parent c83be391ee
commit 82327ea7c6
2 changed files with 50 additions and 0 deletions

View file

@ -40,6 +40,14 @@ FactoryGirl.define do
trait :invalid do
config(rspec: nil)
end
trait :blocked do
status :manual
end
trait :success do
status :success
end
end
end
end

View file

@ -0,0 +1,42 @@
require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::Blocked do
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') }
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