diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb')
-rw-r--r-- | spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb b/spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb new file mode 100644 index 00000000000..4f00b1ec654 --- /dev/null +++ b/spec/lib/error_tracking/collector/sentry_auth_parser_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ErrorTracking::Collector::SentryAuthParser do + describe '.parse' do + let(:headers) { { 'X-Sentry-Auth' => "Sentry sentry_key=glet_1fedb514e17f4b958435093deb02048c" } } + let(:request) { double('request', headers: headers) } + + subject { described_class.parse(request) } + + context 'empty headers' do + let(:headers) { {} } + + it 'fails with exception' do + expect { subject }.to raise_error(StandardError) + end + end + + context 'missing sentry_key' do + let(:headers) { { 'X-Sentry-Auth' => "Sentry foo=bar" } } + + it 'returns empty value for public_key' do + expect(subject[:public_key]).to be_nil + end + end + + it 'returns correct value for public_key' do + expect(subject[:public_key]).to eq('glet_1fedb514e17f4b958435093deb02048c') + end + end +end |