From c0b473418296764764cb716686cd870e7018b242 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 3 Oct 2016 19:15:14 +0300 Subject: added GL_ID --- spec/gitlab_custom_hook_spec.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/gitlab_custom_hook_spec.rb (limited to 'spec/gitlab_custom_hook_spec.rb') diff --git a/spec/gitlab_custom_hook_spec.rb b/spec/gitlab_custom_hook_spec.rb new file mode 100644 index 0000000..f93c8b4 --- /dev/null +++ b/spec/gitlab_custom_hook_spec.rb @@ -0,0 +1,33 @@ +# coding: utf-8 +require 'spec_helper' +require 'pry' +require 'gitlab_custom_hook' + +describe GitlabCustomHook do + let(:gitlab_custom_hook) { GitlabCustomHook.new('key_1') } + let(:hook_path) { File.join(ROOT_PATH, 'spec/support/gl_id_test_hook') } + + context 'pre_receive hook' do + it 'passes GL_ID variable to hook' do + allow(gitlab_custom_hook).to receive(:hook_file).and_return(hook_path) + + expect(gitlab_custom_hook.pre_receive('changes', 'repo_path')).to be_true + end + end + + context 'post_receive hook' do + it 'passes GL_ID variable to hook' do + allow(gitlab_custom_hook).to receive(:hook_file).and_return(hook_path) + + expect(gitlab_custom_hook.post_receive('changes', 'repo_path')).to be_true + end + end + + context 'update hook' do + it 'passes GL_ID variable to hook' do + allow(gitlab_custom_hook).to receive(:hook_file).and_return(hook_path) + + expect(gitlab_custom_hook.update('master', '', '', 'repo_path')).to be_true + end + end +end -- cgit v1.2.1