diff options
Diffstat (limited to 'spec/support/shared_examples/models/with_uploads_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/models/with_uploads_shared_examples.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/support/shared_examples/models/with_uploads_shared_examples.rb b/spec/support/shared_examples/models/with_uploads_shared_examples.rb index f2a4d9919b7..0c930ec1fce 100644 --- a/spec/support/shared_examples/models/with_uploads_shared_examples.rb +++ b/spec/support/shared_examples/models/with_uploads_shared_examples.rb @@ -12,7 +12,7 @@ RSpec.shared_examples 'model with uploads' do |supports_fileuploads| it 'deletes remote uploads' do expect_any_instance_of(CarrierWave::Storage::Fog::File).to receive(:delete).and_call_original - expect { model_object.destroy }.to change { Upload.count }.by(-1) + expect { model_object.destroy! }.to change { Upload.count }.by(-1) end end @@ -21,13 +21,13 @@ RSpec.shared_examples 'model with uploads' do |supports_fileuploads| let!(:uploads) { create_list(:upload, 2, uploader: FileUploader, model: model_object) } it 'deletes any FileUploader uploads which are not mounted' do - expect { model_object.destroy }.to change { Upload.count }.by(-3) + expect { model_object.destroy! }.to change { Upload.count }.by(-3) end it 'deletes local files' do expect_any_instance_of(Uploads::Local).to receive(:delete_keys).with(uploads.map(&:absolute_path)) - model_object.destroy + model_object.destroy! end end @@ -35,14 +35,14 @@ RSpec.shared_examples 'model with uploads' do |supports_fileuploads| let!(:uploads) { create_list(:upload, 2, :object_storage, uploader: FileUploader, model: model_object) } it 'deletes any FileUploader uploads which are not mounted' do - expect { model_object.destroy }.to change { Upload.count }.by(-3) + expect { model_object.destroy! }.to change { Upload.count }.by(-3) end it 'deletes remote files' do expected_array = array_including(*uploads.map(&:path)) expect_any_instance_of(Uploads::Fog).to receive(:delete_keys).with(expected_array) - model_object.destroy + model_object.destroy! end end end |