diff options
Diffstat (limited to 'spec/requests/api/error_tracking')
-rw-r--r-- | spec/requests/api/error_tracking/client_keys_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/error_tracking/collector_spec.rb | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/spec/requests/api/error_tracking/client_keys_spec.rb b/spec/requests/api/error_tracking/client_keys_spec.rb index 00c1e8799e6..ba4d713dff2 100644 --- a/spec/requests/api/error_tracking/client_keys_spec.rb +++ b/spec/requests/api/error_tracking/client_keys_spec.rb @@ -81,6 +81,10 @@ RSpec.describe API::ErrorTracking::ClientKeys do it 'returns a correct status' do expect(response).to have_gitlab_http_status(:ok) end + + it 'returns specific fields using the entity' do + expect(json_response.keys).to match_array(%w[id active public_key sentry_dsn]) + end end end end diff --git a/spec/requests/api/error_tracking/collector_spec.rb b/spec/requests/api/error_tracking/collector_spec.rb index fa0b238dcad..c0d7eb5460f 100644 --- a/spec/requests/api/error_tracking/collector_spec.rb +++ b/spec/requests/api/error_tracking/collector_spec.rb @@ -152,7 +152,17 @@ RSpec.describe API::ErrorTracking::Collector do context 'collector fails with validation error' do before do allow(::ErrorTracking::CollectErrorService) - .to receive(:new).and_raise(ActiveRecord::RecordInvalid) + .to receive(:new).and_raise(Gitlab::ErrorTracking::ErrorRepository::DatabaseError) + end + + it_behaves_like 'bad request' + end + + context 'with platform field too long' do + let(:params) do + event = Gitlab::Json.parse(raw_event) + event['platform'] = 'a' * 256 + Gitlab::Json.dump(event) end it_behaves_like 'bad request' |