diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-07-19 14:31:47 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-07-21 11:22:11 +0300 |
commit | 8877f2e8c16ebb0c1251124659117c7d2c209399 (patch) | |
tree | b6e321c6d2c21d8bd1b08b1f48a04d676df422a8 | |
parent | 2086483b24e719ec8d82b3e7a52476626952885a (diff) |
Reword success to passing for pipeline badges
-rw-r--r-- | changelogs/unreleased/zj-pipeline-badge-improvements.yml | 4 | ||||
-rw-r--r-- | features/steps/project/badges/build.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/badge/pipeline/template.rb | 3 | ||||
-rw-r--r-- | spec/features/projects/badges/pipeline_badge_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/badge/pipeline/template_spec.rb | 2 |
5 files changed, 22 insertions, 3 deletions
diff --git a/changelogs/unreleased/zj-pipeline-badge-improvements.yml b/changelogs/unreleased/zj-pipeline-badge-improvements.yml new file mode 100644 index 00000000000..735192ede2d --- /dev/null +++ b/changelogs/unreleased/zj-pipeline-badge-improvements.yml @@ -0,0 +1,4 @@ +--- +title: Update build badges to be pipeline badges and display passing instead of success +merge_request: +author: diff --git a/features/steps/project/badges/build.rb b/features/steps/project/badges/build.rb index a9dd6e82595..9bcdccfb3bd 100644 --- a/features/steps/project/badges/build.rb +++ b/features/steps/project/badges/build.rb @@ -9,7 +9,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps end step 'I should see a build success badge' do - expect_badge('success') + expect_badge('passed') end step 'I should see a build failed badge' do diff --git a/lib/gitlab/badge/pipeline/template.rb b/lib/gitlab/badge/pipeline/template.rb index 9618a3cf7eb..e09db32262d 100644 --- a/lib/gitlab/badge/pipeline/template.rb +++ b/lib/gitlab/badge/pipeline/template.rb @@ -7,6 +7,7 @@ module Gitlab # Template object will be passed to badge.svg.erb template. # class Template < Badge::Template + STATUS_RENAME = { 'success' => 'passed' }.freeze STATUS_COLOR = { success: '#4c1', failed: '#e05d44', @@ -27,7 +28,7 @@ module Gitlab end def value_text - @status.to_s + STATUS_RENAME[@status.to_s] || @status.to_s end def key_width diff --git a/spec/features/projects/badges/pipeline_badge_spec.rb b/spec/features/projects/badges/pipeline_badge_spec.rb new file mode 100644 index 00000000000..786973d6c2e --- /dev/null +++ b/spec/features/projects/badges/pipeline_badge_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +feature 'pipeline badge' do + let(:project) { create(:project, :repository, :public) } + + # this can't be tested in the controller, as it bypasses the rails router + # and constructs a route based on the controller being tested + # Keep around until 10.0, see gitlab-org/gitlab-ce#35307 + scenario 'user request the deprecated build status badge' do + visit build_project_badges_path(project, ref: project.default_branch, format: :svg) + + expect(page.status_code).to eq(200) + end +end diff --git a/spec/lib/gitlab/badge/pipeline/template_spec.rb b/spec/lib/gitlab/badge/pipeline/template_spec.rb index 24a33ecbfda..20fa4f879c3 100644 --- a/spec/lib/gitlab/badge/pipeline/template_spec.rb +++ b/spec/lib/gitlab/badge/pipeline/template_spec.rb @@ -12,7 +12,7 @@ describe Gitlab::Badge::Pipeline::Template do describe '#value_text' do it 'is status value' do - expect(template.value_text).to eq 'success' + expect(template.value_text).to eq 'passed' end end |