Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-06 21:24:13 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-06 21:24:13 +0300
commit8562cb5f78752b0c043863f363ff2f00420ba5c5 (patch)
treec93308b513a6066dbc0bf9210cc4df44381a663e /spec/lib/gitlab/badge
parent3137a7fec37b7fb66ea464f4c5fdab964a73d390 (diff)
parente995e1f5cdb97ea2a9abc24909f4a85623cf2c10 (diff)
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.rb25
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}")})