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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Remove `combine_options` from attachment#variant since is deprecated in rails 6.1
Damian Kaczmarczyka5fbc439513c
diff --git a/core/app/models/spree/image.rb b/core/app/models/spree/image.rbindex 61f3984f4c..629d77f5c0 100644--- a/core/app/models/spree/image.rb+++ b/core/app/models/spree/image.rb@@ -15,13 +15,13 @@ module Spreewidth, height = size.chop.split('x'){- url: polymorphic_path(attachment.variant(combine_options: {- gravity: 'center',- resize: size,- extent: size,- background: 'snow2',- quality: 80- }), only_path: true),+ url: polymorphic_path(attachment.variant(+ gravity: 'center',+ resize: size,+ extent: size,+ background: 'snow2',+ quality: 80+ ), only_path: true),width: width,height: height}@@ -35,13 +35,13 @@ module Spreewidth, height = size.chop.split('x'){- url: polymorphic_path(attachment.variant(combine_options: {- gravity: 'center',- resize: size,- extent: size,- background: 'snow2',- quality: 80- }), only_path: true),+ url: polymorphic_path(attachment.variant(+ gravity: 'center',+ resize: size,+ extent: size,+ background: 'snow2',+ quality: 80+ ), only_path: true),size: size,width: width,height: heightdiff --git a/core/spec/models/spree/image_spec.rb b/core/spec/models/spree/image_spec.rbindex fd37c20c7c..5da7d45582 100644--- a/core/spec/models/spree/image_spec.rb+++ b/core/spec/models/spree/image_spec.rb@@ -1,11 +1,11 @@require 'spec_helper'describe Spree::Image, type: :model do- context 'validation' do- let(:spree_image) { Spree::Image.new }- let(:image_file) { File.open(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg') }- let(:text_file) { File.open(Spree::Core::Engine.root + 'spec/fixtures' + 'text-file.txt') }+ let(:spree_image) { described_class.new }+ let(:image_file) { File.open("#{Spree::Core::Engine.root}/spec/fixtures/thinking-cat.jpg") }+ let(:text_file) { File.open("#{Spree::Core::Engine.root}/spec/fixtures/text-file.txt") }+ context 'validation' doit 'has attachment present' dospree_image.attachment.attach(io: image_file, filename: 'thinking-cat.jpg')expect(spree_image).to be_valid@@ -16,7 +16,7 @@ describe Spree::Image, type: :model doexpect(spree_image).not_to be_validend- it 'has allowed attachment content type' do+ it 'has allowed attachment content type' dospree_image.attachment.attach(io: image_file, filename: 'thinking-cat.jpg', content_type: 'image/jpeg')expect(spree_image).to be_validend@@ -26,4 +26,24 @@ describe Spree::Image, type: :model doexpect(spree_image).not_to be_validendend++ describe '#styles' do+ it 'will return all styles for the image' do+ spree_image.attachment.attach(io: image_file, filename: 'thinking-cat.jpg', content_type: 'image/jpeg')+ res = spree_image.styles++ expect(res.length).to eq described_class.styles.keys.length+ end+ end++ describe '#style' do+ it 'will return style for the given name' do+ spree_image.attachment.attach(io: image_file, filename: 'thinking-cat.jpg', content_type: 'image/jpeg')+ styles = described_class.styles.keys+ random_style_name = styles.sample+ res = spree_image.style(random_style_name)++ expect(res[:size]).to eq described_class.styles[random_style_name]+ end+ endend