Add response.content_type checks for JSON to api/v1 request specs (#31981)

This commit is contained in:
Matt Jankowski 2024-09-20 09:13:04 -04:00 committed by GitHub
commit 66326065b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
98 changed files with 930 additions and 14 deletions

View file

@ -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