Commit 1da4ae71 authored by Shinya Maeda's avatar Shinya Maeda

Add spec for Status::Pipeline::Scheduled

parent 5f3c1a54
......@@ -54,6 +54,10 @@ FactoryBot.define do
status :manual
end
trait :scheduled do
status :scheduled
end
trait :success do
status :success
end
......
require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::Scheduled 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 'scheduled'
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment