diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-06 20:06:48 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-06 20:06:48 +0300 |
commit | e995e1f5cdb97ea2a9abc24909f4a85623cf2c10 (patch) | |
tree | 381fdb321530470c44149263c55767a77cd4725d /spec/lib | |
parent | c5d3ca3ecb61e95df8a3a5b5f22bbf07b7dc6e15 (diff) | |
parent | ac4e3e8cf016f2c2b3dcf3997673310a5df658a9 (diff) |
Merge remote-tracking branch 'origin/master' into rename-ci-commit
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/badge/build_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/lib/gitlab/badge/build_spec.rb b/spec/lib/gitlab/badge/build_spec.rb index e87bf41ea25..4e4f97cb71b 100644 --- a/spec/lib/gitlab/badge/build_spec.rb +++ b/spec/lib/gitlab/badge/build_spec.rb @@ -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}")}) |