0
0
Fork 0

Remove body_as_json in favor of built-in response.parsed_body for JSON response specs (#31749)

This commit is contained in:
Matt Jankowski 2024-09-06 05:58:46 -04:00 committed by GitHub
parent be77a1098b
commit 6b6a80b407
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
107 changed files with 422 additions and 413 deletions

View file

@ -18,7 +18,7 @@ RSpec.describe '/api/v1/statuses' do
get '/api/v1/statuses', headers: headers, params: { id: [status.id, other_status.id, 123_123] }
expect(response).to have_http_status(200)
expect(body_as_json).to contain_exactly(
expect(response.parsed_body).to contain_exactly(
hash_including(id: status.id.to_s),
hash_including(id: other_status.id.to_s)
)
@ -52,7 +52,7 @@ RSpec.describe '/api/v1/statuses' do
subject
expect(response).to have_http_status(200)
expect(body_as_json[:filtered][0]).to include({
expect(response.parsed_body[:filtered][0]).to include({
filter: a_hash_including({
id: user.account.custom_filters.first.id.to_s,
title: 'filter1',
@ -75,7 +75,7 @@ RSpec.describe '/api/v1/statuses' do
subject
expect(response).to have_http_status(200)
expect(body_as_json[:filtered][0]).to include({
expect(response.parsed_body[:filtered][0]).to include({
filter: a_hash_including({
id: user.account.custom_filters.first.id.to_s,
title: 'filter1',
@ -97,7 +97,7 @@ RSpec.describe '/api/v1/statuses' do
subject
expect(response).to have_http_status(200)
expect(body_as_json[:reblog][:filtered][0]).to include({
expect(response.parsed_body[:reblog][:filtered][0]).to include({
filter: a_hash_including({
id: user.account.custom_filters.first.id.to_s,
title: 'filter1',
@ -154,7 +154,7 @@ RSpec.describe '/api/v1/statuses' do
subject
expect(response).to have_http_status(422)
expect(body_as_json[:unexpected_accounts].map { |a| a.slice(:id, :acct) }).to match [{ id: bob.id.to_s, acct: bob.acct }]
expect(response.parsed_body[:unexpected_accounts].map { |a| a.slice(:id, :acct) }).to match [{ id: bob.id.to_s, acct: bob.acct }]
end
end