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
|
@ -21,6 +21,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(
|
||||
id: media.id.to_s,
|
||||
|
@ -39,6 +41,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(206)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -49,6 +53,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,6 +65,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -75,6 +83,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(MediaAttachment.first).to be_present
|
||||
expect(MediaAttachment.first).to have_attached_file(:file)
|
||||
|
||||
|
@ -102,6 +112,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -112,6 +124,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(500)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -153,6 +167,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -171,6 +187,8 @@ RSpec.describe 'Media' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue