Use built-in response.parsed_body
for JSON response specs (#31674)
This commit is contained in:
parent
388d5473e1
commit
40f993b3a0
10 changed files with 15 additions and 17 deletions
|
@ -94,7 +94,7 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to eq(
|
||||
expect(body_as_json).to match(
|
||||
{
|
||||
id: domain_block.id.to_s,
|
||||
domain: domain_block.domain,
|
||||
|
|
|
@ -26,7 +26,7 @@ describe 'Translation Languages' do
|
|||
.to have_http_status(200)
|
||||
|
||||
expect(body_as_json)
|
||||
.to eq({ und: %w(en de), en: ['de'] })
|
||||
.to match({ und: %w(en de), en: ['de'] })
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -60,7 +60,7 @@ RSpec.describe 'Lists' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to eq({
|
||||
expect(body_as_json).to match({
|
||||
id: list.id.to_s,
|
||||
title: list.title,
|
||||
replies_policy: list.replies_policy,
|
||||
|
@ -144,7 +144,7 @@ RSpec.describe 'Lists' do
|
|||
expect(response).to have_http_status(200)
|
||||
list.reload
|
||||
|
||||
expect(body_as_json).to eq({
|
||||
expect(body_as_json).to match({
|
||||
id: list.id.to_s,
|
||||
title: list.title,
|
||||
replies_policy: list.replies_policy,
|
||||
|
|
|
@ -133,7 +133,7 @@ RSpec.describe 'Requests' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to eq({ merged: true })
|
||||
expect(body_as_json).to match({ merged: true })
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -146,7 +146,7 @@ RSpec.describe 'Requests' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to eq({ merged: false })
|
||||
expect(body_as_json).to match({ merged: false })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe 'Sources' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to eq({
|
||||
expect(body_as_json).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 eq({
|
||||
expect(body_as_json).to match({
|
||||
id: status.id.to_s,
|
||||
text: status.text,
|
||||
spoiler_text: status.spoiler_text,
|
||||
|
|
|
@ -154,7 +154,7 @@ 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 eq [{ id: bob.id.to_s, acct: bob.acct }]
|
||||
expect(body_as_json[:unexpected_accounts].map { |a| a.slice(:id, :acct) }).to match [{ id: bob.id.to_s, acct: bob.acct }]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue