diff options
Diffstat (limited to 'spec/support/shared_examples/lib/sentry/client_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/lib/sentry/client_shared_examples.rb | 37 |
1 files changed, 5 insertions, 32 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 71b32005c55..e0b411e1e2a 100644 --- a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb +++ b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb @@ -78,8 +78,8 @@ end # Expects to following variables: # - subject # - sentry_api_response -# - sentry_url, token - only if enabled_by_default: false -RSpec.shared_examples 'Sentry API response size limit' do |enabled_by_default: false| +# - sentry_url, token +RSpec.shared_examples 'Sentry API response size limit' do let(:invalid_deep_size) { instance_double(Gitlab::Utils::DeepSize, valid?: false) } before do @@ -89,35 +89,8 @@ RSpec.shared_examples 'Sentry API response size limit' do |enabled_by_default: f .and_return(invalid_deep_size) end - if enabled_by_default - it 'raises an exception when response is too large' do - expect { subject }.to raise_error(ErrorTracking::SentryClient::ResponseInvalidSizeError, - 'Sentry API response is too big. Limit is 1 MB.') - end - else - context 'when guarded by feature flag' do - let(:client) do - ErrorTracking::SentryClient.new(sentry_url, token, validate_size_guarded_by_feature_flag: feature_flag) - end - - context 'with feature flag enabled' do - let(:feature_flag) { true } - - it 'raises an exception when response is too large' do - expect { subject }.to raise_error(ErrorTracking::SentryClient::ResponseInvalidSizeError, - 'Sentry API response is too big. Limit is 1 MB.') - end - end - - context 'with feature flag disabled' do - let(:feature_flag) { false } - - it 'does not check the limit and thus not raise' do - expect { subject }.not_to raise_error - - expect(Gitlab::Utils::DeepSize).not_to have_received(:new) - end - end - end + it 'raises an exception when response is too large' do + expect { subject }.to raise_error(ErrorTracking::SentryClient::ResponseInvalidSizeError, + 'Sentry API response is too big. Limit is 1 MB.') end end |