Commit dc6f1dad authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'ab-namespace-badges' into 'master'

Namespace badge under Gitlab::Ci

See merge request gitlab-org/gitlab!51219
parents 61f4ddf2 118f63ba
...@@ -9,7 +9,7 @@ class Projects::BadgesController < Projects::ApplicationController ...@@ -9,7 +9,7 @@ class Projects::BadgesController < Projects::ApplicationController
feature_category :continuous_integration feature_category :continuous_integration
def pipeline def pipeline
pipeline_status = Gitlab::Badge::Pipeline::Status pipeline_status = Gitlab::Ci::Badge::Pipeline::Status
.new(project, params[:ref], opts: { .new(project, params[:ref], opts: {
ignore_skipped: params[:ignore_skipped], ignore_skipped: params[:ignore_skipped],
key_text: params[:key_text], key_text: params[:key_text],
...@@ -20,7 +20,7 @@ class Projects::BadgesController < Projects::ApplicationController ...@@ -20,7 +20,7 @@ class Projects::BadgesController < Projects::ApplicationController
end end
def coverage def coverage
coverage_report = Gitlab::Badge::Coverage::Report coverage_report = Gitlab::Ci::Badge::Coverage::Report
.new(project, params[:ref], opts: { .new(project, params[:ref], opts: {
job: params[:job], job: params[:job],
key_text: params[:key_text], key_text: params[:key_text],
......
...@@ -145,8 +145,8 @@ module Projects ...@@ -145,8 +145,8 @@ module Projects
def define_badges_variables def define_badges_variables
@ref = params[:ref] || @project.default_branch || 'master' @ref = params[:ref] || @project.default_branch || 'master'
@badges = [Gitlab::Badge::Pipeline::Status, @badges = [Gitlab::Ci::Badge::Pipeline::Status,
Gitlab::Badge::Coverage::Report] Gitlab::Ci::Badge::Coverage::Report]
@badges.map! do |badge| @badges.map! do |badge|
badge.new(@project, @ref).metadata badge.new(@project, @ref).metadata
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
class Base class Base
def entity def entity
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Coverage module Coverage
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Coverage module Coverage
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Coverage module Coverage
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
## ##
# Abstract class for badge metadata # Abstract class for badge metadata
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Pipeline module Pipeline
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Pipeline module Pipeline
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
module Pipeline module Pipeline
## ##
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab::Ci
module Badge module Badge
## ##
# Abstract template class for badges # Abstract template class for badges
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
require 'lib/gitlab/badge/shared/metadata' require 'lib/gitlab/ci/badge/shared/metadata'
RSpec.describe Gitlab::Badge::Coverage::Metadata do RSpec.describe Gitlab::Ci::Badge::Coverage::Metadata do
let(:badge) do let(:badge) do
double(project: create(:project), ref: 'feature', job: 'test') double(project: create(:project), ref: 'feature', job: 'test')
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Badge::Coverage::Report do RSpec.describe Gitlab::Ci::Badge::Coverage::Report do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:success_pipeline) { create(:ci_pipeline, :success, project: project) } let_it_be(:success_pipeline) { create(:ci_pipeline, :success, project: project) }
let_it_be(:running_pipeline) { create(:ci_pipeline, :running, project: project) } let_it_be(:running_pipeline) { create(:ci_pipeline, :running, project: project) }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Badge::Coverage::Template do RSpec.describe Gitlab::Ci::Badge::Coverage::Template do
let(:badge) { double(entity: 'coverage', status: 90.00, customization: {}) } let(:badge) { double(entity: 'coverage', status: 90.00, customization: {}) }
let(:template) { described_class.new(badge) } let(:template) { described_class.new(badge) }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
require 'lib/gitlab/badge/shared/metadata' require 'lib/gitlab/ci/badge/shared/metadata'
RSpec.describe Gitlab::Badge::Pipeline::Metadata do RSpec.describe Gitlab::Ci::Badge::Pipeline::Metadata do
let(:badge) { double(project: create(:project), ref: 'feature') } let(:badge) { double(project: create(:project), ref: 'feature') }
let(:metadata) { described_class.new(badge) } let(:metadata) { described_class.new(badge) }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Badge::Pipeline::Status do RSpec.describe Gitlab::Ci::Badge::Pipeline::Status do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:sha) { project.commit.sha } let(:sha) { project.commit.sha }
let(:branch) { 'master' } let(:branch) { 'master' }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Badge::Pipeline::Template do RSpec.describe Gitlab::Ci::Badge::Pipeline::Template do
let(:badge) { double(entity: 'pipeline', status: 'success', customization: {}) } let(:badge) { double(entity: 'pipeline', status: 'success', customization: {}) }
let(:template) { described_class.new(badge) } let(:template) { described_class.new(badge) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment