diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-17 14:30:33 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-17 14:30:33 +0100 |
commit | 9f1beed7a7d5cb70db843c765754b8a4c7de141a (patch) | |
tree | afc3d0c6eb88998654895b04184b6deb4d672f91 | |
parent | 8faf0c7abe9ddd8e9b3932f8f22c8319ada06a35 (diff) | |
download | gitlab-ce-9f1beed7a7d5cb70db843c765754b8a4c7de141a.tar.gz |
Link external commit status badge to a target URL
Using new detailed statuses factory for external commit statuses.
-rw-r--r-- | app/models/generic_commit_status.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/ci/status/external/common.rb | 4 | ||||
-rw-r--r-- | spec/features/projects/pipelines/pipeline_spec.rb | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/app/models/generic_commit_status.rb b/app/models/generic_commit_status.rb index fa54e3540d0..9f6ca11c0df 100644 --- a/app/models/generic_commit_status.rb +++ b/app/models/generic_commit_status.rb @@ -12,4 +12,10 @@ class GenericCommitStatus < CommitStatus def tags [:external] end + + def detailed_status(current_user) + Gitlab::Ci::Status::External::Factory + .new(self, current_user) + .fabricate! + end end diff --git a/lib/gitlab/ci/status/external/common.rb b/lib/gitlab/ci/status/external/common.rb index f067381d6a8..4969a350862 100644 --- a/lib/gitlab/ci/status/external/common.rb +++ b/lib/gitlab/ci/status/external/common.rb @@ -4,8 +4,8 @@ module Gitlab module External module Common def has_details? - can?(user, :read_commit_status, subject) && - subject.target_url.present? + subject.target_url.present? && + can?(user, :read_commit_status, subject) end def details_path diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 0ecc5b1dfee..8f90bd45677 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -36,7 +36,8 @@ describe 'Pipeline', :feature, :js do create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', - stage: 'external') + stage: 'external', + target_url: 'http://gitlab.com/status') end end @@ -139,6 +140,7 @@ describe 'Pipeline', :feature, :js do it 'shows the success icon and the generic comit status build' do expect(page).to have_selector('.ci-status-icon-success') expect(page).to have_content('jenkins') + expect(page).to have_link('jenkins', href: 'http://gitlab.com/status') end end end |