diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 21:08:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 21:08:16 +0300 |
commit | e9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd (patch) | |
tree | 7b778e44f210132af1233ceb8801b388ac3519f5 /spec/models | |
parent | 946771d0b016ae92b15a60bc3290a33b94191ffe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index cf1690df9ba..76051ecb177 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -2813,6 +2813,30 @@ describe Ci::Pipeline, :mailer do end end + describe '#created_successfully?' do + subject { pipeline.created_successfully? } + + context 'when pipeline is not persisted' do + let(:pipeline) { build(:ci_pipeline) } + + it { is_expected.to be_falsey } + end + + context 'when pipeline is persisted' do + context 'when pipeline has failure reasons' do + let(:pipeline) { create(:ci_pipeline, failure_reason: :config_error) } + + it { is_expected.to be_falsey } + end + + context 'when pipeline has no failure reasons' do + let(:pipeline) { create(:ci_pipeline, failure_reason: nil) } + + it { is_expected.to be_truthy } + end + end + end + describe '#parent_pipeline' do let(:project) { create(:project) } let(:pipeline) { create(:ci_pipeline, project: project) } @@ -2960,8 +2984,7 @@ describe Ci::Pipeline, :mailer do it 'can not update bridge status if is not active' do bridge.success! - expect { pipeline.update_bridge_status! } - .to raise_error Ci::Pipeline::BridgeStatusError + expect { pipeline.update_bridge_status! }.not_to change { bridge.status } end end end @@ -2992,9 +3015,12 @@ describe Ci::Pipeline, :mailer do end describe '#update_bridge_status!' do - it 'can not update upstream job status' do - expect { pipeline.update_bridge_status! } - .to raise_error ArgumentError + it 'tracks an ArgumentError and does not update upstream job status' do + expect(Gitlab::ErrorTracking) + .to receive(:track_exception) + .with(instance_of(ArgumentError), pipeline_id: pipeline.id) + + pipeline.update_bridge_status! end end end |