diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-26 09:48:48 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-26 09:48:48 +0000 |
commit | 4503240abdd9a38e801aef49edad9ff9c7f9457d (patch) | |
tree | 801f974ef54782e0cb7a7d5dd6373749dcd30e1a /spec/models | |
parent | 07f6ab2b5339e3db171b6b53c972e1bdf17dffc9 (diff) | |
parent | caf6b9918e3f7a79c9ffcffd1880f29422d50eb5 (diff) | |
download | gitlab-ce-4503240abdd9a38e801aef49edad9ff9c7f9457d.tar.gz |
Merge branch 'fix/gb/fix-skipped-pipeline-with-allowed-to-fail-jobs' into 'master'
Fix pipeline status when allowed to fail jobs present
Closes #29059
See merge request !11166
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/commit_status_spec.rb | 35 | ||||
-rw-r--r-- | spec/models/concerns/has_status_spec.rb | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 9262ce08987..1e074c7ad26 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -284,6 +284,41 @@ describe CommitStatus, :models do end end + describe '.status' do + context 'when there are multiple statuses present' do + before do + create_status(status: 'running') + create_status(status: 'success') + create_status(allow_failure: true, status: 'failed') + end + + it 'returns a correct compound status' do + expect(described_class.all.status).to eq 'running' + end + end + + context 'when there are only allowed to fail commit statuses present' do + before do + create_status(allow_failure: true, status: 'failed') + end + + it 'returns status that indicates success' do + expect(described_class.all.status).to eq 'success' + end + end + + context 'when using a scope to select latest statuses' do + before do + create_status(name: 'test', retried: true, status: 'failed') + create_status(allow_failure: true, name: 'test', status: 'failed') + end + + it 'returns status according to the scope' do + expect(described_class.latest.status).to eq 'success' + end + end + end + describe '#before_sha' do subject { commit_status.before_sha } diff --git a/spec/models/concerns/has_status_spec.rb b/spec/models/concerns/has_status_spec.rb index 101567998c9..a38f2553eb1 100644 --- a/spec/models/concerns/has_status_spec.rb +++ b/spec/models/concerns/has_status_spec.rb @@ -48,7 +48,7 @@ describe HasStatus do [create(type, status: :failed, allow_failure: true)] end - it { is_expected.to eq 'skipped' } + it { is_expected.to eq 'success' } end context 'success and canceled' do |