Use Ci::Pipeline#latest for finding pipelines
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7333#note_18861407
This commit is contained in:
parent
6192ea53fa
commit
101cde38cf
|
|
@ -20,7 +20,8 @@ module Gitlab
|
||||||
|
|
||||||
def status
|
def status
|
||||||
@project.pipelines
|
@project.pipelines
|
||||||
.where(sha: @sha, ref: @ref)
|
.where(sha: @sha)
|
||||||
|
.latest(@ref)
|
||||||
.status || 'unknown'
|
.status || 'unknown'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ describe Gitlab::Badge::Build::Status do
|
||||||
new_build.success!
|
new_build.success!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'reports the compound status' do
|
it 'does not take outdated pipeline into account' do
|
||||||
expect(badge.status).to eq 'failed'
|
expect(badge.status).to eq 'success'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue