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:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-07-19 14:08:47 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-07-21 11:22:09 +0300
commit2086483b24e719ec8d82b3e7a52476626952885a (patch)
treea7d8fe979a0e2309b7517804e452d7162ccd422b /spec/lib/gitlab/badge
parenteaceee0fb9e23982571c9c2a878d662ba241240e (diff)
Rename build to pipeline for status badges
First commit in probably 2, for resolve gitlab-org/gitlab-ce#15582. This commit is renaming files and classes from build to pipeline. Also wording is editted to pipeline. Given `pipeline` had more characters than `build`, I've made the field a bit wider. The width now matchers the one for the coverage badge, so they look nice when in a table format, or in a list. As soon as this commit is merged to master, and released, the build.svg is deprecated, meaning that all users which already placed a badge should update it. However, to make sure it keeps working tests are added for this case.
Diffstat (limited to 'spec/lib/gitlab/badge')
-rw-r--r--spec/lib/gitlab/badge/pipeline/metadata_spec.rb (renamed from spec/lib/gitlab/badge/build/metadata_spec.rb)6
-rw-r--r--spec/lib/gitlab/badge/pipeline/status_spec.rb (renamed from spec/lib/gitlab/badge/build/status_spec.rb)37
-rw-r--r--spec/lib/gitlab/badge/pipeline/template_spec.rb (renamed from spec/lib/gitlab/badge/build/template_spec.rb)16
3 files changed, 29 insertions, 30 deletions
diff --git a/spec/lib/gitlab/badge/build/metadata_spec.rb b/spec/lib/gitlab/badge/pipeline/metadata_spec.rb
index 9df96ea04eb..d537ce8803c 100644
--- a/spec/lib/gitlab/badge/build/metadata_spec.rb
+++ b/spec/lib/gitlab/badge/pipeline/metadata_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'lib/gitlab/badge/shared/metadata'
-describe Gitlab::Badge::Build::Metadata do
+describe Gitlab::Badge::Pipeline::Metadata do
let(:badge) { double(project: create(:empty_project), ref: 'feature') }
let(:metadata) { described_class.new(badge) }
@@ -9,13 +9,13 @@ describe Gitlab::Badge::Build::Metadata do
describe '#title' do
it 'returns build status title' do
- expect(metadata.title).to eq 'build status'
+ expect(metadata.title).to eq 'pipeline status'
end
end
describe '#image_url' do
it 'returns valid url' do
- expect(metadata.image_url).to include 'badges/feature/build.svg'
+ expect(metadata.image_url).to include 'badges/feature/pipeline.svg'
end
end
diff --git a/spec/lib/gitlab/badge/build/status_spec.rb b/spec/lib/gitlab/badge/pipeline/status_spec.rb
index 6abf4ca46a9..dc835375c66 100644
--- a/spec/lib/gitlab/badge/build/status_spec.rb
+++ b/spec/lib/gitlab/badge/pipeline/status_spec.rb
@@ -1,36 +1,35 @@
require 'spec_helper'
-describe Gitlab::Badge::Build::Status do
+describe Gitlab::Badge::Pipeline::Status do
let(:project) { create(:project, :repository) }
let(:sha) { project.commit.sha }
let(:branch) { 'master' }
let(:badge) { described_class.new(project, branch) }
describe '#entity' do
- it 'always says build' do
- expect(badge.entity).to eq 'build'
+ it 'always says pipeline' do
+ expect(badge.entity).to eq 'pipeline'
end
end
describe '#template' do
it 'returns badge template' do
- expect(badge.template.key_text).to eq 'build'
+ expect(badge.template.key_text).to eq 'pipeline'
end
end
describe '#metadata' do
it 'returns badge metadata' do
- expect(badge.metadata.image_url)
- .to include 'badges/master/build.svg'
+ expect(badge.metadata.image_url).to include 'badges/master/pipeline.svg'
end
end
- context 'build exists' do
- let!(:build) { create_build(project, sha, branch) }
+ context 'pipeline exists' do
+ let!(:pipeline) { create_pipeline(project, sha, branch) }
- context 'build success' do
+ context 'pipeline success' do
before do
- build.success!
+ pipeline.success!
end
describe '#status' do
@@ -40,9 +39,9 @@ describe Gitlab::Badge::Build::Status do
end
end
- context 'build failed' do
+ context 'pipeline failed' do
before do
- build.drop!
+ pipeline.drop!
end
describe '#status' do
@@ -54,10 +53,10 @@ describe Gitlab::Badge::Build::Status do
context 'when outdated pipeline for given ref exists' do
before do
- build.success!
+ pipeline.success!
- old_build = create_build(project, '11eeffdd', branch)
- old_build.drop!
+ old_pipeline = create_pipeline(project, '11eeffdd', branch)
+ old_pipeline.drop!
end
it 'does not take outdated pipeline into account' do
@@ -67,10 +66,10 @@ describe Gitlab::Badge::Build::Status do
context 'when multiple pipelines exist for given sha' do
before do
- build.drop!
+ pipeline.drop!
- new_build = create_build(project, sha, branch)
- new_build.success!
+ new_pipeline = create_pipeline(project, sha, branch)
+ new_pipeline.success!
end
it 'does not take outdated pipeline into account' do
@@ -87,7 +86,7 @@ describe Gitlab::Badge::Build::Status do
end
end
- def create_build(project, sha, branch)
+ def create_pipeline(project, sha, branch)
pipeline = create(:ci_empty_pipeline,
project: project,
sha: sha,
diff --git a/spec/lib/gitlab/badge/build/template_spec.rb b/spec/lib/gitlab/badge/pipeline/template_spec.rb
index a7e21fb8bb1..24a33ecbfda 100644
--- a/spec/lib/gitlab/badge/build/template_spec.rb
+++ b/spec/lib/gitlab/badge/pipeline/template_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
-describe Gitlab::Badge::Build::Template do
- let(:badge) { double(entity: 'build', status: 'success') }
+describe Gitlab::Badge::Pipeline::Template do
+ let(:badge) { double(entity: 'pipeline', status: 'success') }
let(:template) { described_class.new(badge) }
describe '#key_text' do
- it 'is always says build' do
- expect(template.key_text).to eq 'build'
+ it 'is always says pipeline' do
+ expect(template.key_text).to eq 'pipeline'
end
end
@@ -18,11 +18,11 @@ describe Gitlab::Badge::Build::Template do
describe 'widths and text anchors' do
it 'has fixed width and text anchors' do
- expect(template.width).to eq 92
- expect(template.key_width).to eq 38
+ expect(template.width).to eq 116
+ expect(template.key_width).to eq 62
expect(template.value_width).to eq 54
- expect(template.key_text_anchor).to eq 19
- expect(template.value_text_anchor).to eq 65
+ expect(template.key_text_anchor).to eq 31
+ expect(template.value_text_anchor).to eq 89
end
end