diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:05:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:05:22 +0300 |
commit | 10d9a3bf50cca85dd857c5306a34d7a6032580e6 (patch) | |
tree | 9ecd7fbf59c0e43c143c1d46fd437a9810aa6067 /spec/support | |
parent | 6ed97cad88c8518155867b9a6a7896d7085a2f4e (diff) |
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/lib/sentry/client_shared_examples.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb index 1c0e0061385..71b32005c55 100644 --- a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb +++ b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb @@ -59,6 +59,22 @@ RSpec.shared_examples 'maps Sentry exceptions' do |http_method| end end +RSpec.shared_examples 'non-numeric input handling in Sentry response' do |field| + context 'with non-numeric error id' do + where(:id_input) do + ['string', '-1', '1\n2'] + end + + with_them do + it 'raises exception' do + message = %(Sentry API response contains invalid value for field "#{field}": #{id_input.inspect} is not numeric) + + expect { subject }.to raise_error(ErrorTracking::SentryClient::InvalidFieldValueError, message) + end + end + end +end + # Expects to following variables: # - subject # - sentry_api_response |