diff options
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/operation_service_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/operation_service_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb index 45701b501bb..4e16f760235 100644 --- a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GitalyClient::OperationService do +RSpec.describe Gitlab::GitalyClient::OperationService do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } let(:repository) { project.repository.raw } @@ -191,6 +191,20 @@ describe Gitlab::GitalyClient::OperationService do it { expect(subject).to be_nil } end + + context "when the pre-receive hook fails" do + let(:response) do + Gitaly::UserFFBranchResponse.new( + branch_update: nil, + pre_receive_error: "pre-receive hook error message\n" + ) + end + + it "raises the error" do + # the PreReceiveError class strips the GL-HOOK-ERR prefix from this error + expect { subject }.to raise_error(Gitlab::Git::PreReceiveError, "pre-receive hook failed.") + end + end end shared_examples 'cherry pick and revert errors' do |