diff options
Diffstat (limited to 'spec/lib/gitlab/puma/error_handler_spec.rb')
-rw-r--r-- | spec/lib/gitlab/puma/error_handler_spec.rb | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/spec/lib/gitlab/puma/error_handler_spec.rb b/spec/lib/gitlab/puma/error_handler_spec.rb index 5b7cdf37af1..bfcbf32e899 100644 --- a/spec/lib/gitlab/puma/error_handler_spec.rb +++ b/spec/lib/gitlab/puma/error_handler_spec.rb @@ -12,11 +12,10 @@ RSpec.describe Gitlab::Puma::ErrorHandler, feature_category: :shared do describe '#execute' do it 'captures the exception and returns a Rack response' do - allow(Raven.configuration).to receive(:capture_allowed?).and_return(true) - expect(Raven).to receive(:capture_exception).with( + expect(Gitlab::ErrorTracking).to receive(:track_exception).with( ex, - tags: { handler: 'puma_low_level' }, - extra: { puma_env: env, status_code: status_code } + { puma_env: env, status_code: status_code }, + { handler: 'puma_low_level' } ).and_call_original status, headers, message = subject.execute(ex, env, status_code) @@ -26,25 +25,10 @@ RSpec.describe Gitlab::Puma::ErrorHandler, feature_category: :shared do expect(message).to eq(described_class::PROD_ERROR_MESSAGE) end - context 'when capture is not allowed' do - it 'returns a Rack response without capturing the exception' do - allow(Raven.configuration).to receive(:capture_allowed?).and_return(false) - expect(Raven).not_to receive(:capture_exception) - - status, headers, message = subject.execute(ex, env, status_code) - - expect(status).to eq(500) - expect(headers).to eq({}) - expect(message).to eq(described_class::PROD_ERROR_MESSAGE) - end - end - context 'when not in production' do let(:is_production) { false } it 'returns a Rack response with dev error message' do - allow(Raven.configuration).to receive(:capture_allowed?).and_return(true) - status, headers, message = subject.execute(ex, env, status_code) expect(status).to eq(500) @@ -57,9 +41,6 @@ RSpec.describe Gitlab::Puma::ErrorHandler, feature_category: :shared do let(:status_code) { 500 } it 'defaults to error 500' do - allow(Raven.configuration).to receive(:capture_allowed?).and_return(false) - expect(Raven).not_to receive(:capture_exception) - status, headers, message = subject.execute(ex, env, status_code) expect(status).to eq(500) @@ -72,8 +53,6 @@ RSpec.describe Gitlab::Puma::ErrorHandler, feature_category: :shared do let(:status_code) { 404 } it 'uses the provided status code in the response' do - allow(Raven.configuration).to receive(:capture_allowed?).and_return(true) - status, headers, message = subject.execute(ex, env, status_code) expect(status).to eq(404) |