summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-02 14:21:04 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-02 14:23:43 +0100
commitc7c249407e98bf5fc099cd89901e67b000fdf69d (patch)
tree1e9c1deb55637743e2cab577cb758b94b51d6ad6
parent0c7168b98d69dc4071873a2787e4974a4c24ea20 (diff)
downloadgitlab-ce-c7c249407e98bf5fc099cd89901e67b000fdf69d.tar.gz
Add implementation of common pipeline extended status
-rw-r--r--lib/gitlab/ci/status/core/base.rb2
-rw-r--r--lib/gitlab/ci/status/extended/pipeline/common.rb7
-rw-r--r--spec/lib/gitlab/ci/status/extended/pipeline/common_spec.rb23
3 files changed, 28 insertions, 4 deletions
diff --git a/lib/gitlab/ci/status/core/base.rb b/lib/gitlab/ci/status/core/base.rb
index f7687c49ffd..d1896a610b7 100644
--- a/lib/gitlab/ci/status/core/base.rb
+++ b/lib/gitlab/ci/status/core/base.rb
@@ -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
diff --git a/lib/gitlab/ci/status/extended/pipeline/common.rb b/lib/gitlab/ci/status/extended/pipeline/common.rb
index 75d392fab6c..1b70ba303dc 100644
--- a/lib/gitlab/ci/status/extended/pipeline/common.rb
+++ b/lib/gitlab/ci/status/extended/pipeline/common.rb
@@ -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?
diff --git a/spec/lib/gitlab/ci/status/extended/pipeline/common_spec.rb b/spec/lib/gitlab/ci/status/extended/pipeline/common_spec.rb
index e69de29bb2d..32939800c70 100644
--- a/spec/lib/gitlab/ci/status/extended/pipeline/common_spec.rb
+++ b/spec/lib/gitlab/ci/status/extended/pipeline/common_spec.rb
@@ -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