diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/services/branches | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
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 |