Merge remote-tracking branch 'origin/master' into rename-ci-commit
This commit is contained in:
commit
e995e1f5cd
1 changed files with 23 additions and 3 deletions
|
@ -42,9 +42,7 @@ describe Gitlab::Badge::Build do
|
|||
end
|
||||
|
||||
context 'build exists' do
|
||||
let(:ci_commit) { create(:ci_commit, project: project, sha: sha, ref: branch) }
|
||||
let!(:build) { create(:ci_build, pipeline: ci_commit) }
|
||||
|
||||
let!(:build) { create_build(project, sha, branch) }
|
||||
|
||||
context 'build success' do
|
||||
before { build.success! }
|
||||
|
@ -96,6 +94,28 @@ 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.to_s).to eq 'build-success'
|
||||
end
|
||||
end
|
||||
|
||||
def create_build(project, sha, branch)
|
||||
ci_commit = create(:ci_commit, project: project,
|
||||
sha: sha,
|
||||
ref: branch)
|
||||
|
||||
create(:ci_build, pipeline: ci_commit)
|
||||
end
|
||||
|
||||
def status_node(data, status)
|
||||
xml = Nokogiri::XML.parse(data)
|
||||
xml.at(%Q{text:contains("#{status}")})
|
||||
|
|
Loading…
Reference in a new issue