Commit 57df84d2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend build badge specs to cover multiple pipelines

parent d98566dc
...@@ -53,6 +53,32 @@ describe Gitlab::Badge::Build do ...@@ -53,6 +53,32 @@ describe Gitlab::Badge::Build do
end end
end 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 end
context 'build does not exist' do context 'build does not exist' do
...@@ -69,20 +95,6 @@ describe Gitlab::Badge::Build do ...@@ -69,20 +95,6 @@ describe Gitlab::Badge::Build do
end end
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) def create_build(project, sha, branch)
pipeline = create(:ci_pipeline, project: project, pipeline = create(:ci_pipeline, project: project,
sha: sha, sha: sha,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment