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
|
@ -29,7 +29,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and contain_exactly(
|
||||
include(
|
||||
|
@ -50,7 +50,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and have_attributes(
|
||||
size: 2
|
||||
|
@ -70,7 +70,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and have_attributes(
|
||||
size: 3
|
||||
|
@ -89,7 +89,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
it 'removes duplicate account IDs from params' do
|
||||
subject
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and have_attributes(
|
||||
size: 2
|
||||
|
@ -141,7 +141,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
it 'returns JSON with correct data on previously cached requests' do
|
||||
# Initial request including multiple accounts in params
|
||||
get '/api/v1/accounts/relationships', headers: headers, params: { id: [simon.id, lewis.id] }
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to have_attributes(size: 2)
|
||||
|
||||
# Subsequent request with different id, should override cache from first request
|
||||
|
@ -150,7 +150,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and have_attributes(
|
||||
size: 1
|
||||
|
@ -172,7 +172,7 @@ RSpec.describe 'GET /api/v1/accounts/relationships' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Enumerable)
|
||||
.and contain_exactly(
|
||||
include(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue