Combine double subject in `api/v1/media` shared example (#28943)

pull/28951/head
Matt Jankowski 2024-01-26 11:35:49 -05:00 committed by GitHub
parent 5fbdb2055b
commit 09a3493fca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 8 deletions

View File

@ -76,20 +76,14 @@ RSpec.describe 'Media' do
let(:params) { {} }
shared_examples 'a successful media upload' do |media_type|
it 'uploads the file successfully', :aggregate_failures do
it 'uploads the file successfully and returns correct media content', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(MediaAttachment.first).to be_present
expect(MediaAttachment.first).to have_attached_file(:file)
end
it 'returns the correct media content' do
subject
body = body_as_json
expect(body).to match(
expect(body_as_json).to match(
a_hash_including(id: MediaAttachment.first.id.to_s, description: params[:description], type: media_type)
)
end