Use expect for api/v1 and api/web push subs controllers (#33682)

This commit is contained in:
Matt Jankowski 2025-01-22 09:55:44 -05:00 committed by GitHub
parent b18caff5b6
commit 607f65a0a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 4 deletions

View file

@ -52,4 +52,28 @@ RSpec.describe 'API Web Push Subscriptions' do
end
end
end
describe 'POST /api/web/push_subscriptions' do
before { sign_in Fabricate :user }
it 'gracefully handles invalid nested params' do
post api_web_push_subscriptions_path, params: { subscription: 'invalid' }
expect(response)
.to have_http_status(400)
end
end
describe 'PUT /api/web/push_subscriptions' do
before { sign_in Fabricate :user }
let(:subscription) { Fabricate :web_push_subscription }
it 'gracefully handles invalid nested params' do
put api_web_push_subscription_path(subscription), params: { data: 'invalid' }
expect(response)
.to have_http_status(400)
end
end
end