summaryrefslogtreecommitdiff
path: root/spec/services/git_hooks_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/git_hooks_service_spec.rb')
-rw-r--r--spec/services/git_hooks_service_spec.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/spec/services/git_hooks_service_spec.rb b/spec/services/git_hooks_service_spec.rb
index 2bb9c3b3db3..3fc37a315c0 100644
--- a/spec/services/git_hooks_service_spec.rb
+++ b/spec/services/git_hooks_service_spec.rb
@@ -16,19 +16,18 @@ describe GitHooksService, services: true do
end
describe '#execute' do
-
context 'when receive hooks were successful' do
it 'should call post-receive hook' do
- hook = double(trigger: true)
+ hook = double(trigger: [true, nil])
expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook)
- expect(service.execute(user, @repo_path, @blankrev, @newrev, @ref) { }).to eq(true)
+ expect(service.execute(user, @repo_path, @blankrev, @newrev, @ref) { }).to eq([true, nil])
end
end
context 'when pre-receive hook failed' do
it 'should not call post-receive hook' do
- expect(service).to receive(:run_hook).with('pre-receive').and_return(false)
+ expect(service).to receive(:run_hook).with('pre-receive').and_return([false, ''])
expect(service).not_to receive(:run_hook).with('post-receive')
expect do
@@ -39,8 +38,8 @@ describe GitHooksService, services: true do
context 'when update hook failed' do
it 'should not call post-receive hook' do
- expect(service).to receive(:run_hook).with('pre-receive').and_return(true)
- expect(service).to receive(:run_hook).with('update').and_return(false)
+ expect(service).to receive(:run_hook).with('pre-receive').and_return([true, nil])
+ expect(service).to receive(:run_hook).with('update').and_return([false, ''])
expect(service).not_to receive(:run_hook).with('post-receive')
expect do
@@ -48,6 +47,5 @@ describe GitHooksService, services: true do
end.to raise_error(GitHooksService::PreReceiveError)
end
end
-
end
end