debian-mirror-gitlab/spec/lib/gitlab/ci/status/pipeline/delayed_spec.rb

45 lines
952 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-12-05 23:21:45 +05:30
require 'spec_helper'
2018-12-13 13:39:08 +05:30
describe Gitlab::Ci::Status::Pipeline::Delayed do
2018-12-05 23:21:45 +05:30
let(:pipeline) { double('pipeline') }
subject do
described_class.new(pipeline)
end
describe '#text' do
it 'overrides status text' do
2018-12-13 13:39:08 +05:30
expect(subject.text).to eq 'delayed'
2018-12-05 23:21:45 +05:30
end
end
describe '#label' do
it 'overrides status label' do
expect(subject.label).to eq 'waiting for delayed job'
end
end
describe '.matches?' do
let(:user) { double('user') }
subject { described_class.matches?(pipeline, user) }
context 'when pipeline is scheduled' do
let(:pipeline) { create(:ci_pipeline, :scheduled) }
it 'is a correct match' do
expect(subject).to be true
end
end
context 'when pipeline is not scheduled' do
let(:pipeline) { create(:ci_pipeline, :success) }
it 'does not match' do
expect(subject).to be false
end
end
end
end