Remove body_as_json in favor of built-in response.parsed_body for JSON response specs (#31749)
This commit is contained in:
@@ -29,7 +29,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to be_empty
|
||||
expect(response.parsed_body).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns all unresolved reports' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match_array(expected_response)
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with resolved param' do
|
||||
@@ -74,7 +74,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns only the resolved reports' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match_array(expected_response)
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns all unresolved reports filed by the specified account' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match_array(expected_response)
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns all unresolved reports targeting the specified account' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match_array(expected_response)
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -106,7 +106,7 @@ RSpec.describe 'Reports' do
|
||||
it 'returns only the requested number of reports' do
|
||||
subject
|
||||
|
||||
expect(body_as_json.size).to eq(1)
|
||||
expect(response.parsed_body.size).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -126,7 +126,7 @@ RSpec.describe 'Reports' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to include(
|
||||
expect(response.parsed_body).to include(
|
||||
{
|
||||
id: report.id.to_s,
|
||||
action_taken: report.action_taken?,
|
||||
@@ -159,7 +159,7 @@ RSpec.describe 'Reports' do
|
||||
|
||||
report.reload
|
||||
|
||||
expect(body_as_json).to include(
|
||||
expect(response.parsed_body).to include(
|
||||
{
|
||||
id: report.id.to_s,
|
||||
action_taken: report.action_taken?,
|
||||
|
||||
Reference in New Issue
Block a user