Fix RSpec/StubbedMock
cop (#25552)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -16,7 +16,7 @@ RSpec.describe Api::V1::MediaController do
|
||||
describe 'with paperclip errors' do
|
||||
context 'when imagemagick cant identify the file type' do
|
||||
it 'returns http 422' do
|
||||
expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Errors::NotIdentifiedByImageMagickError)
|
||||
allow_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Errors::NotIdentifiedByImageMagickError)
|
||||
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
@@ -25,7 +25,7 @@ RSpec.describe Api::V1::MediaController do
|
||||
|
||||
context 'when there is a generic error' do
|
||||
it 'returns http 422' do
|
||||
expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Error)
|
||||
allow_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Error)
|
||||
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
|
||||
|
||||
expect(response).to have_http_status(500)
|
||||
|
Reference in New Issue
Block a user