From 63e2ca5d27c7594149efa11426354e07d743fc27 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 10 Nov 2025 05:06:47 -0500 Subject: [PATCH] Add spec for hitting max status pins limit in pin api (#36789) --- spec/requests/api/v1/statuses/pins_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/requests/api/v1/statuses/pins_spec.rb b/spec/requests/api/v1/statuses/pins_spec.rb index 05d8f570cc..66ed1510a4 100644 --- a/spec/requests/api/v1/statuses/pins_spec.rb +++ b/spec/requests/api/v1/statuses/pins_spec.rb @@ -57,6 +57,21 @@ RSpec.describe 'Pins' do end end + context 'when the account is already at MAX status pins' do + before { StatusPinValidator::PIN_LIMIT.times { Fabricate(:status_pin, account: user.account) } } + + it 'returns http unprocessable entity' do + subject + + expect(response) + .to have_http_status(422) + expect(response.media_type) + .to eq('application/json') + expect(response.parsed_body) + .to include(error: /already pinned the maximum/) + end + end + context 'when the status does not exist' do it 'returns http not found' do post '/api/v1/statuses/-1/pin', headers: headers