Add implementation of common pipeline extended status

This commit is contained in:
Grzegorz Bizon 2016-12-02 14:21:04 +01:00
parent 0c7168b98d
commit c7c249407e
3 changed files with 28 additions and 4 deletions

View File

@ -4,6 +4,8 @@ module Gitlab::Ci
# Base abstract class fore core status
#
class Base
include Gitlab::Routing.url_helpers
def initialize(subject)
@subject = subject
end

View File

@ -3,15 +3,14 @@ module Gitlab::Ci
module Extended
module Pipeline
module Common
def initialize(pipeline)
@pipeline = pipeline
end
def has_details?
true
end
def details_path
namespace_project_pipeline_path(@subject.project.namespace,
@subject.project,
@subject)
end
def has_action?

View File

@ -0,0 +1,23 @@
require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Pipeline::Common do
let(:pipeline) { create(:ci_pipeline) }
subject do
Gitlab::Ci::Status::Core::Success
.new(pipeline).extend(described_class)
end
it 'does not have action' do
expect(subject).not_to have_action
end
it 'has details' do
expect(subject).to have_details
end
it 'links to the pipeline details page' do
expect(subject.details_path)
.to include "pipelines/#{pipeline.id}"
end
end