diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 14:37:29 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 14:37:29 +0100 |
commit | d55ff247569a2bf5c78c80f966a56b28d5c8332f (patch) | |
tree | b51ad0389be54b436f87fcff0f9a19fcf5d09542 | |
parent | c7c249407e98bf5fc099cd89901e67b000fdf69d (diff) | |
download | gitlab-ce-d55ff247569a2bf5c78c80f966a56b28d5c8332f.tar.gz |
Implement extended pipeline - status with warnings
-rw-r--r-- | spec/lib/gitlab/ci/status/extended/base_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/extended/pipeline/success_with_warnings_spec.rb | 65 |
2 files changed, 77 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/status/extended/base_spec.rb b/spec/lib/gitlab/ci/status/extended/base_spec.rb index e69de29bb2d..7cdc68c927f 100644 --- a/spec/lib/gitlab/ci/status/extended/base_spec.rb +++ b/spec/lib/gitlab/ci/status/extended/base_spec.rb @@ -0,0 +1,12 @@ +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 diff --git a/spec/lib/gitlab/ci/status/extended/pipeline/success_with_warnings_spec.rb b/spec/lib/gitlab/ci/status/extended/pipeline/success_with_warnings_spec.rb index e69de29bb2d..b1a63c5f2f9 100644 --- a/spec/lib/gitlab/ci/status/extended/pipeline/success_with_warnings_spec.rb +++ b/spec/lib/gitlab/ci/status/extended/pipeline/success_with_warnings_spec.rb @@ -0,0 +1,65 @@ +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 |