From 09a3493fcacf7ae4f190fceb3c22a0510eac022f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 26 Jan 2024 11:35:49 -0500 Subject: [PATCH] Combine double subject in `api/v1/media` shared example (#28943) --- spec/requests/api/v1/media_spec.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/spec/requests/api/v1/media_spec.rb b/spec/requests/api/v1/media_spec.rb index 2c29328087..26c76b9c5b 100644 --- a/spec/requests/api/v1/media_spec.rb +++ b/spec/requests/api/v1/media_spec.rb @@ -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