Commit d55ff247 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Implement extended pipeline - status with warnings

parent c7c24940
require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Base do
subject do
Class.new.extend(described_class)
end
it 'requires subclass to implement matcher' do
expect { subject.matches?(double) }
.to raise_error(NotImplementedError)
end
end
require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Pipeline::SuccessWithWarnings do
subject do
described_class.new(double('status'))
end
describe '#test' do
it { expect(subject.text).to eq 'passed' }
end
describe '#label' do
it { expect(subject.label).to eq 'passed with warnings' }
end
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_warning' }
end
describe '.matches?' do
context 'when pipeline is successful' do
let(:pipeline) do
create(:ci_pipeline, status: :success)
end
context 'when pipeline has warnings' do
before do
allow(pipeline).to receive(:has_warnings?).and_return(true)
end
it 'is a correct match' do
expect(described_class.matches?(pipeline)).to eq true
end
end
context 'when pipeline does not have warnings' do
it 'does not match' do
expect(described_class.matches?(pipeline)).to eq false
end
end
end
context 'when pipeline is not successful' do
let(:pipeline) do
create(:ci_pipeline, status: :skipped)
end
context 'when pipeline has warnings' do
before do
allow(pipeline).to receive(:has_warnings?).and_return(true)
end
it 'does not match' do
expect(described_class.matches?(pipeline)).to eq false
end
end
context 'when pipeline does not have warnings' do
it 'does not match' do
expect(described_class.matches?(pipeline)).to eq false
end
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