0
0
Fork 0

DB speedup in API:: controller/request specs (#25516)

This commit is contained in:
Matt Jankowski 2023-10-13 08:42:09 -04:00 committed by GitHub
parent ecdb31d479
commit fd9dea21d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 181 additions and 746 deletions

View file

@ -19,30 +19,24 @@ describe Api::V1::Accounts::NotesController do
post :create, params: { account_id: account.id, comment: comment }
end
context 'when account note has reasonable length' do
context 'when account note has reasonable length', :aggregate_failures do
let(:comment) { 'foo' }
it 'returns http success' do
subject
expect(response).to have_http_status(200)
end
it 'updates account note' do
subject
expect(response).to have_http_status(200)
expect(AccountNote.find_by(account_id: user.account.id, target_account_id: account.id).comment).to eq comment
end
end
context 'when account note exceeds allowed length' do
context 'when account note exceeds allowed length', :aggregate_failures do
let(:comment) { 'a' * 2_001 }
it 'returns 422' do
subject
expect(response).to have_http_status(422)
end
it 'does not create account note' do
subject
expect(response).to have_http_status(422)
expect(AccountNote.where(account_id: user.account.id, target_account_id: account.id)).to_not exist
end
end