Commit 4a13abe6 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '347357-fix-service-hook-log-link' into 'master'

Fix hook log path for integration hooks (FKA service hooks)

See merge request gitlab-org/gitlab!77741
parents b19453e7 ab1c7854
...@@ -39,7 +39,7 @@ module HooksHelper ...@@ -39,7 +39,7 @@ module HooksHelper
def hook_log_path(hook, hook_log) def hook_log_path(hook, hook_log)
case hook case hook
when ProjectHook when ProjectHook, ServiceHook
hook_log.present.details_path hook_log.present.details_path
when SystemHook when SystemHook
admin_hook_hook_log_path(hook, hook_log) admin_hook_hook_log_path(hook, hook_log)
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe HooksHelper do RSpec.describe HooksHelper do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:project_hook) { create(:project_hook, project: project) } let(:project_hook) { create(:project_hook, project: project) }
let(:service_hook) { create(:service_hook, integration: create(:drone_ci_integration)) }
let(:system_hook) { create(:system_hook) } let(:system_hook) { create(:system_hook) }
describe '#link_to_test_hook' do describe '#link_to_test_hook' do
...@@ -31,6 +32,15 @@ RSpec.describe HooksHelper do ...@@ -31,6 +32,15 @@ RSpec.describe HooksHelper do
end end
end end
context 'with a service hook' do
let(:web_hook_log) { create(:web_hook_log, web_hook: service_hook) }
it 'returns project-namespaced link' do
expect(helper.hook_log_path(project_hook, web_hook_log))
.to eq(web_hook_log.present.details_path)
end
end
context 'with a system hook' do context 'with a system hook' do
let(:web_hook_log) { create(:web_hook_log, web_hook: system_hook) } let(:web_hook_log) { create(:web_hook_log, web_hook: system_hook) }
......
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