Skip to content

Commit

Permalink
Incorporate Paperclip adapter in DummyApp
Browse files Browse the repository at this point in the history
Only when we are testing against Paperclip in the build matrix.
  • Loading branch information
kennyadsl committed Jun 1, 2023
1 parent abebafd commit 87bc6c3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 87bc6c3

Please sign in to comment.