Remove body_as_json
in favor of built-in response.parsed_body
for JSON response specs (#31749)
This commit is contained in:
parent
be77a1098b
commit
6b6a80b407
107 changed files with 422 additions and 413 deletions
|
@ -28,7 +28,7 @@ RSpec.describe 'Bookmarks' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, bookmarked: true)
|
||||
)
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ RSpec.describe 'Bookmarks' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, bookmarked: false)
|
||||
)
|
||||
end
|
||||
|
@ -127,7 +127,7 @@ RSpec.describe 'Bookmarks' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, bookmarked: false)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -34,9 +34,9 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
|
|||
next: api_v1_status_favourited_by_index_url(limit: 2, max_id: Favourite.first.id)
|
||||
)
|
||||
|
||||
expect(body_as_json.size)
|
||||
expect(response.parsed_body.size)
|
||||
.to eq(2)
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
include(id: alice.id.to_s),
|
||||
include(id: bob.id.to_s)
|
||||
|
@ -48,9 +48,9 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
|
|||
|
||||
subject
|
||||
|
||||
expect(body_as_json.size)
|
||||
expect(response.parsed_body.size)
|
||||
.to eq 1
|
||||
expect(body_as_json.first[:id]).to eq(alice.id.to_s)
|
||||
expect(response.parsed_body.first[:id]).to eq(alice.id.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ RSpec.describe 'Favourites', :inline_jobs do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, favourites_count: 1, favourited: true)
|
||||
)
|
||||
end
|
||||
|
@ -95,7 +95,7 @@ RSpec.describe 'Favourites', :inline_jobs do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false)
|
||||
)
|
||||
end
|
||||
|
@ -118,7 +118,7 @@ RSpec.describe 'Favourites', :inline_jobs do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe 'API V1 Statuses Histories' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json.size).to_not be 0
|
||||
expect(response.parsed_body.size).to_not be 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ RSpec.describe 'Pins' do
|
|||
it 'return json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, pinned: true)
|
||||
)
|
||||
end
|
||||
|
@ -96,7 +96,7 @@ RSpec.describe 'Pins' do
|
|||
it 'return json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, pinned: false)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -33,9 +33,9 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
|
|||
next: api_v1_status_reblogged_by_index_url(limit: 2, max_id: alice.statuses.first.id)
|
||||
)
|
||||
|
||||
expect(body_as_json.size)
|
||||
expect(response.parsed_body.size)
|
||||
.to eq(2)
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
include(id: alice.id.to_s),
|
||||
include(id: bob.id.to_s)
|
||||
|
@ -47,9 +47,9 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
|
|||
|
||||
subject
|
||||
|
||||
expect(body_as_json.size)
|
||||
expect(response.parsed_body.size)
|
||||
.to eq 1
|
||||
expect(body_as_json.first[:id]).to eq(alice.id.to_s)
|
||||
expect(response.parsed_body.first[:id]).to eq(alice.id.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ RSpec.describe 'API V1 Statuses Reblogs' do
|
|||
|
||||
expect(user.account.reblogged?(status)).to be true
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
reblog: include(
|
||||
id: status.id.to_s,
|
||||
|
@ -60,7 +60,7 @@ RSpec.describe 'API V1 Statuses Reblogs' do
|
|||
|
||||
expect(user.account.reblogged?(status)).to be false
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
id: status.id.to_s,
|
||||
reblogs_count: 0,
|
||||
|
@ -85,7 +85,7 @@ RSpec.describe 'API V1 Statuses Reblogs' do
|
|||
|
||||
expect(user.account.reblogged?(status)).to be false
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
id: status.id.to_s,
|
||||
reblogs_count: 0,
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe 'Sources' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to match({
|
||||
expect(response.parsed_body).to match({
|
||||
id: status.id.to_s,
|
||||
text: status.text,
|
||||
spoiler_text: status.spoiler_text,
|
||||
|
@ -51,7 +51,7 @@ RSpec.describe 'Sources' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to match({
|
||||
expect(response.parsed_body).to match({
|
||||
id: status.id.to_s,
|
||||
text: status.text,
|
||||
spoiler_text: status.spoiler_text,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue