diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-06 20:24:13 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-06 20:24:13 +0200 |
commit | 8562cb5f78752b0c043863f363ff2f00420ba5c5 (patch) | |
tree | c93308b513a6066dbc0bf9210cc4df44381a663e /spec/lib/gitlab/badge | |
parent | 3137a7fec37b7fb66ea464f4c5fdab964a73d390 (diff) | |
parent | e995e1f5cdb97ea2a9abc24909f4a85623cf2c10 (diff) | |
download | gitlab-ce-8562cb5f78752b0c043863f363ff2f00420ba5c5.tar.gz |
Merge branch 'rename-ci-commit' into rename-ci-commit-phase-2
Diffstat (limited to 'spec/lib/gitlab/badge')
-rw-r--r-- | spec/lib/gitlab/badge/build_spec.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/lib/gitlab/badge/build_spec.rb b/spec/lib/gitlab/badge/build_spec.rb index 530c43bfc0d..aec5a5bc3b2 100644 --- a/spec/lib/gitlab/badge/build_spec.rb +++ b/spec/lib/gitlab/badge/build_spec.rb @@ -42,8 +42,7 @@ describe Gitlab::Badge::Build do end context 'build exists' do - let(:pipeline) { create(:ci_pipeline, project: project, sha: sha, ref: branch) } - let!(:build) { create(:ci_build, pipeline: pipeline) } + let!(:build) { create_build(project, sha, branch) } context 'build success' do before { build.success! } @@ -95,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) + pipeline = create(:ci_pipeline, project: project, + sha: sha, + ref: branch) + + create(:ci_build, pipeline: pipeline) + end + def status_node(data, status) xml = Nokogiri::XML.parse(data) xml.at(%Q{text:contains("#{status}")}) |