From 37148a6c56ab252728cba9c11c5f25ed889211f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 25 Nov 2016 20:27:33 +0200 Subject: test gl_id_test_hook as global and as repo hook separately --- spec/gitlab_custom_hook_spec.rb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/spec/gitlab_custom_hook_spec.rb b/spec/gitlab_custom_hook_spec.rb index faa4f2b..5cc9e0b 100644 --- a/spec/gitlab_custom_hook_spec.rb +++ b/spec/gitlab_custom_hook_spec.rb @@ -81,9 +81,32 @@ describe GitlabCustomHook do cleanup_hook_setup end - context 'with gl_id_test_hook' do + context 'with gl_id_test_hook as repo hook' do before do create_repo_hooks(hook_gl_id) + end + + context 'pre_receive hook' do + it 'passes GL_ID variable to hook' do + expect(gitlab_custom_hook.pre_receive(changes)).to eq(true) + end + end + + context 'post_receive hook' do + it 'passes GL_ID variable to hook' do + expect(gitlab_custom_hook.post_receive(changes)).to eq(true) + end + end + + context 'update hook' do + it 'passes GL_ID variable to hook' do + expect(gitlab_custom_hook.update(ref_name, old_value, new_value)).to eq(true) + end + end + end + + context 'with gl_id_test_hook as global hook' do + before do create_global_hooks_d(hook_gl_id) end -- cgit v1.2.1