diff options
author | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:30:22 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:31:49 +0300 |
commit | bf218337ed5bd535856204ef1878a1495fa37dfe (patch) | |
tree | 66415495c994a17fb0c45bcfcb4a3d08d808098f /spec/services | |
parent | 021b6aef94b3398ab5603b4c11afd4c6d8432795 (diff) | |
download | gitlab-ce-bf218337ed5bd535856204ef1878a1495fa37dfe.tar.gz |
Better message for git hooks and file locks
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/create_tag_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/git_hooks_service_spec.rb | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/services/create_tag_service_spec.rb b/spec/services/create_tag_service_spec.rb index 91f9e663b66..7dc43c50b0d 100644 --- a/spec/services/create_tag_service_spec.rb +++ b/spec/services/create_tag_service_spec.rb @@ -41,12 +41,12 @@ describe CreateTagService, services: true do it 'returns an error' do expect(repository).to receive(:add_tag). with(user, 'v1.1.0', 'master', 'Foo'). - and_raise(GitHooksService::PreReceiveError) + and_raise(GitHooksService::PreReceiveError, 'something went wrong') response = service.execute('v1.1.0', 'master', 'Foo') expect(response).to eq(status: :error, - message: 'Tag creation was rejected by Git hook') + message: 'something went wrong') end end end diff --git a/spec/services/git_hooks_service_spec.rb b/spec/services/git_hooks_service_spec.rb index 6367ac832e8..3fc37a315c0 100644 --- a/spec/services/git_hooks_service_spec.rb +++ b/spec/services/git_hooks_service_spec.rb @@ -18,16 +18,16 @@ describe GitHooksService, services: true do 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 @@ -38,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 |