Update markers API spec for error case (#29096)

shrike
Matt Jankowski 2024-02-06 07:47:04 -05:00 committed by GitHub
parent 4fb7f611de
commit df7acdcee5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -52,5 +52,19 @@ RSpec.describe 'API Markers' do
expect(user.markers.first.last_read_id).to eq 70_120
end
end
context 'when database object becomes stale' do
before do
allow(Marker).to receive(:transaction).and_raise(ActiveRecord::StaleObjectError)
post '/api/v1/markers', headers: headers, params: { home: { last_read_id: '69420' } }
end
it 'returns error json' do
expect(response)
.to have_http_status(409)
expect(body_as_json)
.to include(error: /Conflict during update/)
end
end
end
end