Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Modify Icon factory to support not having attachment (#11634)

Aleksandar Petrushev12d551bbdd99
diff --git a/core/lib/spree/testing_support/factories/icon_factory.rb b/core/lib/spree/testing_support/factories/icon_factory.rb
index 049043ff47..6db61604d6 100644
--- a/core/lib/spree/testing_support/factories/icon_factory.rb
+++ b/core/lib/spree/testing_support/factories/icon_factory.rb
@@ -1,7 +1,9 @@
FactoryBot.define do
factory :icon, class: Spree::Icon do
before(:create) do |icon|
- icon.attachment.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
+ if icon.respond_to? :attachment
+ icon.attachment.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
+ end
end
end
end