blob: 4f00b1ec6543efbd1bad3ea31b0de52bf23c5370 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|