Extend build badge specs to cover multiple pipelines
This commit is contained in:
parent
d98566dcbc
commit
57df84d2fc
1 changed files with 26 additions and 14 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue