summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2016-11-20 15:43:00 +0200
committerSean McGivern <sean@gitlab.com>2016-12-01 11:41:03 +0000
commit8910d4b069cea1c5d1fa25f192ca20afc062ed9d (patch)
tree03ea28ba0bb9d84575ae1615ed68cb25585b10d4
parent5043d13bac184ed1092a67afb33a1b108c5e03d6 (diff)
downloadgitlab-shell-8910d4b069cea1c5d1fa25f192ca20afc062ed9d.tar.gz
fix gl_id_test_hook
-rw-r--r--spec/gitlab_custom_hook_spec.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/spec/gitlab_custom_hook_spec.rb b/spec/gitlab_custom_hook_spec.rb
index f6b16bb..e47fae0 100644
--- a/spec/gitlab_custom_hook_spec.rb
+++ b/spec/gitlab_custom_hook_spec.rb
@@ -7,6 +7,7 @@ describe GitlabCustomHook do
let(:tmp_root_path) { File.join(ROOT_PATH, 'tmp') }
let(:hook_ok) { File.join(ROOT_PATH, 'spec', 'support', 'hook_ok') }
let(:hook_fail) { File.join(ROOT_PATH, 'spec', 'support', 'hook_fail') }
+ let(:hook_gl_id) { File.join(ROOT_PATH, 'spec', 'support', 'gl_id_test_hook') }
let(:vars) { {"GL_ID" => "key_1"} }
let(:old_value) { "old-value" }
@@ -82,29 +83,26 @@ describe GitlabCustomHook do
end
context 'with gl_id_test_hook' do
- let(:hook_path) { File.join(ROOT_PATH, 'spec/support/gl_id_test_hook') }
+ before do
+ create_repo_hooks(tmp_repo_path, hook_gl_id)
+ create_global_hooks_d(tmp_root_path, hook_gl_id)
+ end
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)).to be_true
+ 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
- allow(gitlab_custom_hook).to receive(:hook_file).and_return(hook_path)
-
- expect(gitlab_custom_hook.post_receive(changes)).to be_true
+ expect(gitlab_custom_hook.post_receive(changes)).to eq(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(ref_name, old_value, new_value)).to be_true
+ expect(gitlab_custom_hook.update(ref_name, old_value, new_value)).to eq(true)
end
end
end