summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2016-11-25 20:27:33 +0200
committerSean McGivern <sean@gitlab.com>2016-12-01 11:41:03 +0000
commit37148a6c56ab252728cba9c11c5f25ed889211f1 (patch)
treeec837c4f5b278abd72496ae57b10062895fb8068
parent24d6df6c882c4224d66271f81cc04c5a9ba3b3f5 (diff)
downloadgitlab-shell-37148a6c56ab252728cba9c11c5f25ed889211f1.tar.gz
test gl_id_test_hook as global and as repo hook separately
-rw-r--r--spec/gitlab_custom_hook_spec.rb25
1 files changed, 24 insertions, 1 deletions
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