Commit 9f1beed7 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Link external commit status badge to a target URL

Using new detailed statuses factory for external commit statuses.
parent 8faf0c7a
...@@ -12,4 +12,10 @@ class GenericCommitStatus < CommitStatus ...@@ -12,4 +12,10 @@ class GenericCommitStatus < CommitStatus
def tags def tags
[:external] [:external]
end end
def detailed_status(current_user)
Gitlab::Ci::Status::External::Factory
.new(self, current_user)
.fabricate!
end
end end
...@@ -4,8 +4,8 @@ module Gitlab ...@@ -4,8 +4,8 @@ module Gitlab
module External module External
module Common module Common
def has_details? def has_details?
can?(user, :read_commit_status, subject) && subject.target_url.present? &&
subject.target_url.present? can?(user, :read_commit_status, subject)
end end
def details_path def details_path
......
...@@ -36,7 +36,8 @@ describe 'Pipeline', :feature, :js do ...@@ -36,7 +36,8 @@ describe 'Pipeline', :feature, :js do
create(:generic_commit_status, status: 'success', create(:generic_commit_status, status: 'success',
pipeline: pipeline, pipeline: pipeline,
name: 'jenkins', name: 'jenkins',
stage: 'external') stage: 'external',
target_url: 'http://gitlab.com/status')
end end
end end
...@@ -139,6 +140,7 @@ describe 'Pipeline', :feature, :js do ...@@ -139,6 +140,7 @@ describe 'Pipeline', :feature, :js do
it 'shows the success icon and the generic comit status build' 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_selector('.ci-status-icon-success')
expect(page).to have_content('jenkins') expect(page).to have_content('jenkins')
expect(page).to have_link('jenkins', href: 'http://gitlab.com/status')
end end
end end
end end
......
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