diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-09 13:33:19 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-09 13:33:19 +0200 |
commit | 57df84d2fc5a03e0bf25a289dca715d6f0990d62 (patch) | |
tree | 1257e837f5ff38ad6884632b6f286eb0a1399af4 | |
parent | d98566dcbcea1058503e46bfb2bfe9f4c102c515 (diff) | |
download | gitlab-ce-57df84d2fc5a03e0bf25a289dca715d6f0990d62.tar.gz |
Extend build badge specs to cover multiple pipelines
-rw-r--r-- | spec/lib/gitlab/badge/build_spec.rb | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/spec/lib/gitlab/badge/build_spec.rb b/spec/lib/gitlab/badge/build_spec.rb index f9abbdaf585..ef9d9e7fef4 100644 --- a/spec/lib/gitlab/badge/build_spec.rb +++ b/spec/lib/gitlab/badge/build_spec.rb @@ -53,6 +53,32 @@ describe Gitlab::Badge::Build do end end end + + context 'when outdated pipeline for given ref exists' do + before do + build.success! + + old_build = create_build(project, '11eeffdd', branch) + old_build.drop! + end + + it 'does not take outdated pipeline into account' do + expect(badge.status).to eq 'success' + end + end + + context 'when multiple pipelines exist for given sha' do + before do + build.drop! + + new_build = create_build(project, sha, branch) + new_build.success! + end + + it 'reports the compound status' do + expect(badge.status).to eq 'failed' + end + end end context 'build does not exist' do @@ -69,20 +95,6 @@ describe Gitlab::Badge::Build do end end - context 'when outdated pipeline for given ref exists' do - before do - build = create_build(project, sha, branch) - build.success! - - old_build = create_build(project, '11eeffdd', branch) - old_build.drop! - end - - it 'does not take outdated pipeline into account' do - expect(badge.status).to eq 'success' - end - end - def create_build(project, sha, branch) pipeline = create(:ci_pipeline, project: project, sha: sha, |