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.
This commit is contained in:
Javi Martín
2021-07-27 02:56:31 +02:00
parent bc18a6e10e
commit 04585d289c

View File

@@ -58,12 +58,4 @@ shared_examples "acts as imageable" do |imageable_factory|
expect(image).not_to be_valid expect(image).not_to be_valid
end end
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 end