diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-11 15:11:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-11 15:11:56 +0300 |
commit | cb787abec6e64a220b2807469023f4de210dac10 (patch) | |
tree | 4f9a8a03a0c9ca91efd08e5baa74859d24e7e2e9 /spec/helpers | |
parent | 31a9181ed65e80ceac2cbd6e2dba9af40e7b0d0b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/hooks_helper_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/helpers/hooks_helper_spec.rb b/spec/helpers/hooks_helper_spec.rb index 92e082c4974..3b23d705790 100644 --- a/spec/helpers/hooks_helper_spec.rb +++ b/spec/helpers/hooks_helper_spec.rb @@ -6,9 +6,10 @@ RSpec.describe HooksHelper do let(:project) { create(:project) } let(:project_hook) { create(:project_hook, project: project) } let(:system_hook) { create(:system_hook) } - let(:trigger) { 'push_events' } describe '#link_to_test_hook' do + let(:trigger) { 'push_events' } + it 'returns project namespaced link' do expect(helper.link_to_test_hook(project_hook, trigger)) .to include("href=\"#{test_project_hook_path(project, project_hook, trigger: trigger)}\"") @@ -19,4 +20,24 @@ RSpec.describe HooksHelper do .to include("href=\"#{test_admin_hook_path(system_hook, trigger: trigger)}\"") end end + + describe '#hook_log_path' do + context 'with a project hook' do + let(:web_hook_log) { create(:web_hook_log, web_hook: project_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 + let(:web_hook_log) { create(:web_hook_log, web_hook: system_hook) } + + it 'returns admin-namespaced link' do + expect(helper.hook_log_path(system_hook, web_hook_log)) + .to eq(admin_hook_hook_log_path(system_hook, web_hook_log)) + end + end + end end |