diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-06 06:10:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-06 06:10:05 +0300 |
commit | abf508470ef1e667bcfa42c4e9b825bcce06e60c (patch) | |
tree | 3217a7d18df4c8da15e5f1d078f967c736ba6f20 /spec/services/branches | |
parent | 631ed6dcca9d41d0dc24dd553065de1a0f8210f0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/branches')
-rw-r--r-- | spec/services/branches/create_service_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/branches/create_service_spec.rb b/spec/services/branches/create_service_spec.rb index b682a3f26ec..5cf0d5af75f 100644 --- a/spec/services/branches/create_service_spec.rb +++ b/spec/services/branches/create_service_spec.rb @@ -44,5 +44,25 @@ RSpec.describe Branches::CreateService do expect(result[:message]).to eq('Invalid reference name: unknown') end end + + it 'logs and returns an error if there is a PreReceiveError exception' do + error_message = 'pre receive error' + raw_message = "GitLab: #{error_message}" + pre_receive_error = Gitlab::Git::PreReceiveError.new(raw_message) + + allow(project.repository).to receive(:add_branch).and_raise(pre_receive_error) + + expect(Gitlab::ErrorTracking).to receive(:track_exception).with( + pre_receive_error, + pre_receive_message: raw_message, + branch_name: 'new-feature', + ref: 'unknown' + ) + + result = service.execute('new-feature', 'unknown') + + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq(error_message) + end end end |