Remove Paperclip and use just Active Storage

This commit is contained in:
Javi Martín
2021-07-28 01:55:54 +02:00
parent ca7f2bc9d5
commit 7212657c02
33 changed files with 128 additions and 355 deletions

View File

@@ -40,8 +40,8 @@ describe DirectUpload do
direct_upload.save_attachment
expect(File.exist?(direct_upload.relation.file_path)).to be true
expect(direct_upload.relation.storage_attachment.blob).to be_persisted
expect(direct_upload.relation.storage_attachment.attachment).not_to be_persisted
expect(direct_upload.relation.attachment.blob).to be_persisted
expect(direct_upload.relation.attachment.attachment).not_to be_persisted
end
end
end

View File

@@ -4,14 +4,11 @@ describe Document do
it_behaves_like "document validations", "budget_investment_document"
it_behaves_like "document validations", "proposal_document"
it "stores attachments with both Paperclip and Active Storage" do
it "stores attachments with Active Storage" do
document = create(:document, attachment: File.new("spec/fixtures/files/clippy.pdf"))
expect(document.attachment).to exist
expect(document.attachment_file_name).to eq "clippy.pdf"
expect(document.storage_attachment).to be_attached
expect(document.storage_attachment.filename).to eq "clippy.pdf"
expect(document.attachment).to be_attached
expect(document.attachment.filename).to eq "clippy.pdf"
end
context "scopes" do

View File

@@ -4,13 +4,10 @@ describe Image do
it_behaves_like "image validations", "budget_investment_image"
it_behaves_like "image validations", "proposal_image"
it "stores attachments with both Paperclip and Active Storage" do
it "stores attachments with Active Storage" do
image = create(:image, attachment: File.new("spec/fixtures/files/clippy.jpg"))
expect(image.attachment).to exist
expect(image.attachment_file_name).to eq "clippy.jpg"
expect(image.storage_attachment).to be_attached
expect(image.storage_attachment.filename).to eq "clippy.jpg"
expect(image.attachment).to be_attached
expect(image.attachment.filename).to eq "clippy.jpg"
end
end

View File

@@ -1,15 +1,12 @@
require "rails_helper"
describe SiteCustomization::Image do
it "stores images with both Paperclip and Active Storage" do
it "stores images with Active Storage" do
image = create(:site_customization_image, name: "map",
image: File.new("spec/fixtures/files/custom_map.jpg"))
expect(image.image).to exist
expect(image.image_file_name).to eq "custom_map.jpg"
expect(image.storage_image).to be_attached
expect(image.storage_image.filename).to eq "custom_map.jpg"
expect(image.image).to be_attached
expect(image.image.filename).to eq "custom_map.jpg"
end
describe "logo" do