From 04585d289ceea6af54d2bb0346e9c3bd79ea1154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 27 Jul 2021 02:56:31 +0200 Subject: [PATCH] Remove not-so-precise attachments test We were testing the URL of the image changes to `missing.png`, but actually that's confusing because the image record is now invalid and so its changes can't be saved. That means that, when rendered in the browser, the image won't render the `missing.png` image but will try to render the destroyed one. If we want to render the `missing.png` image when the attachment has been destroyed, we need to remove the attachment presence validation or change the `url` method so it detects when an attachment is missing. --- spec/shared/models/acts_as_imageable.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spec/shared/models/acts_as_imageable.rb b/spec/shared/models/acts_as_imageable.rb index 3b18e6930..b4624372d 100644 --- a/spec/shared/models/acts_as_imageable.rb +++ b/spec/shared/models/acts_as_imageable.rb @@ -58,12 +58,4 @@ shared_examples "acts as imageable" do |imageable_factory| expect(image).not_to be_valid end end - - it "image destroy should remove image from file storage" do - image.save! - image_url = image.attachment.url - new_url = "/attachments/original/missing.png" - - expect { image.attachment.destroy }.to change { image.attachment.url }.from(image_url).to(new_url) - end end