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

This commit is contained in:
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

View file

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