From 87bc6c3b1f865b8abd6b2c6076119ddf2fe88e01 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Tue, 30 May 2023 16:26:39 +0200 Subject: [PATCH] Incorporate Paperclip adapter in DummyApp Only when we are testing against Paperclip in the build matrix. --- core/lib/spree/testing_support/dummy_app.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/lib/spree/testing_support/dummy_app.rb b/core/lib/spree/testing_support/dummy_app.rb index 7fce19d65cd..64c0d4f85d1 100644 --- a/core/lib/spree/testing_support/dummy_app.rb +++ b/core/lib/spree/testing_support/dummy_app.rb @@ -8,6 +8,7 @@ require 'action_controller/railtie' require 'action_mailer/railtie' require 'active_storage/engine' +require 'generators/solidus/paperclip_adapter/install/install_generator' Rails.env = 'test' @@ -41,6 +42,14 @@ def self.setup(gem_root:, lib_name:, auto_migrate: true) if auto_migrate DummyApp::Migrations.auto_migrate end + + if ENV['DISABLE_ACTIVE_STORAGE'] == 'true' + Rails::Generators.invoke('solidus:paperclip_adapter:install', [ + "--set_preferences=false", + "--app_directory=#{DummyApp::Application.config.root}", + "--app_name=DummyApp", + ]) + end end class Application < ::Rails::Application @@ -135,10 +144,8 @@ class Application < ::Rails::Application Spree.load_defaults(Spree.solidus_version) Spree.config do |config| if (ENV['DISABLE_ACTIVE_STORAGE'] == 'true') - Spree::Deprecation.silence do - config.image_attachment_module = 'Spree::Image::PaperclipAttachment' - config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment' - end + config.image_attachment_module = 'DummyApp::Image::PaperclipAttachment' + config.taxon_attachment_module = 'DummyApp::Taxon::PaperclipAttachment' end end