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.

Bump Rails to 7.0.0.rc1 (#11555)

Damian Legawiec2446dfac2fd2
diff --git a/common_spree_dependencies.rb b/common_spree_dependencies.rb
index aebb808b9c..e6e726ab12 100644
--- a/common_spree_dependencies.rb
+++ b/common_spree_dependencies.rb
@@ -9,7 +9,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
actionmailer actionpack actionview activejob activemodel activerecord
activestorage activesupport railties
].each do |rails_gem|
- gem rails_gem, ENV.fetch('RAILS_VERSION', '~> 7.0.0.alpha2'), require: false
+ gem rails_gem, ENV.fetch('RAILS_VERSION', '~> 7.0.0.rc1'), require: false
end
platforms :jruby do
@@ -24,6 +24,8 @@ platforms :ruby do
end
end
+gem 'sprockets-rails', '>= 2.0.0'
+
if ENV['RAILS_VERSION']&.match(/7\.0\.0/) || !ENV['RAILS_VERSION']
gem 'paranoia', github: 'payrollhero/paranoia', branch: 'rails7'
gem 'awesome_nested_set', github: 'damianlegawiec/awesome_nested_set', branch: 'master'
diff --git a/core/app/models/spree/order_merger.rb b/core/app/models/spree/order_merger.rb
index adc310ee0d..83c29af6ff 100644
--- a/core/app/models/spree/order_merger.rb
+++ b/core/app/models/spree/order_merger.rb
@@ -54,7 +54,7 @@ module Spree
# Change the error messages as you choose.
def handle_error(line_item)
- order.errors[:base] << line_item.errors.full_messages
+ order.errors.add(:base, line_item.errors.full_messages)
end
def persist_merge
diff --git a/core/app/models/spree/promotion_rule.rb b/core/app/models/spree/promotion_rule.rb
index 43ed52310c..4dac29c322 100644
--- a/core/app/models/spree/promotion_rule.rb
+++ b/core/app/models/spree/promotion_rule.rb
@@ -35,7 +35,7 @@ module Spree
def unique_per_promotion
if Spree::PromotionRule.exists?(promotion_id: promotion_id, type: self.class.name)
- errors[:base] << 'Promotion already contains this rule type'
+ errors.add(:base, 'Promotion already contains this rule type')
end
end
diff --git a/core/spec/lib/spree/core/importer/order_spec.rb b/core/spec/lib/spree/core/importer/order_spec.rb
index 959335632f..31cef18f8e 100644
--- a/core/spec/lib/spree/core/importer/order_spec.rb
+++ b/core/spec/lib/spree/core/importer/order_spec.rb
@@ -439,7 +439,8 @@ module Spree
line_items_attributes: line_items,
adjustments_attributes: [
{ label: 'Order Discount', amount: -5.99 }
- ]
+ ],
+ additional_tax_total: 0
}
order = Importer::Order.import(user, params)
diff --git a/core/spec/models/spree/promotion_rule_spec.rb b/core/spec/models/spree/promotion_rule_spec.rb
index 7c880f8e8f..c3f057ab18 100644
--- a/core/spec/models/spree/promotion_rule_spec.rb
+++ b/core/spec/models/spree/promotion_rule_spec.rb
@@ -10,18 +10,17 @@ module Spree
end
end
+ let!(:promotion) { create(:promotion) }
+
it 'forces developer to implement eligible? method' do
expect { BadTestRule.new.eligible? }.to raise_error(ArgumentError)
end
it 'validates unique rules for a promotion' do
- p1 = TestRule.new
- p1.promotion_id = 1
- p1.save
+ TestRule.create!(promotion: promotion)
- p2 = TestRule.new
- p2.promotion_id = 1
- expect(p2).not_to be_valid
+ promotion_rule = TestRule.new(promotion: promotion)
+ expect(promotion_rule).not_to be_valid
end
end
end