Add response.content_type
checks for JSON to api/v1
request specs (#31981)
This commit is contained in:
parent
a7dbf6f5a5
commit
66326065b0
98 changed files with 930 additions and 14 deletions
|
@ -19,6 +19,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
prev: api_v1_account_statuses_url(limit: 1, min_id: status.id),
|
||||
next: api_v1_account_statuses_url(limit: 1, max_id: status.id)
|
||||
)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'with only media' do
|
||||
|
@ -26,6 +28,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
get "/api/v1/accounts/#{user.account.id}/statuses", params: { only_media: true }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -41,6 +45,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
it 'returns posts along with self replies', :aggregate_failures do
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to have_attributes(size: 2)
|
||||
.and contain_exactly(
|
||||
|
@ -61,6 +67,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
.and include_pagination_headers(prev: api_v1_account_statuses_url(pinned: true, min_id: Status.first.id))
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,6 +87,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
prev: api_v1_account_statuses_url(pinned: true, min_id: Status.first.id),
|
||||
next: api_v1_account_statuses_url(pinned: true, max_id: Status.first.id)
|
||||
)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,6 +106,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
get "/api/v1/accounts/#{account.id}/statuses", params: { pinned: true }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when user does not follow account' do
|
||||
|
@ -122,6 +134,8 @@ RSpec.describe 'API V1 Accounts Statuses' do
|
|||
a_hash_including(id: status.id.to_s),
|
||||
a_hash_including(id: private_status.id.to_s)
|
||||
)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue