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
|
|
@ -18,6 +18,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -36,6 +38,8 @@ RSpec.describe 'Links' do
|
|||
.to change_link_trendable_to_true
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expects_correct_link_data
|
||||
end
|
||||
|
||||
|
|
@ -60,6 +64,8 @@ RSpec.describe 'Links' do
|
|||
post '/api/v1/admin/trends/links/-1/approve', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -70,6 +76,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -89,6 +97,8 @@ RSpec.describe 'Links' do
|
|||
.to_not change_link_trendable
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
def change_link_trendable
|
||||
|
|
@ -114,6 +124,8 @@ RSpec.describe 'Links' do
|
|||
post '/api/v1/admin/trends/links/-1/reject', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -124,6 +136,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue