From 6d44a136686a3f6f4b25cbdbba0a5fc61bdfd9a8 Mon Sep 17 00:00:00 2001 From: Adam Mueller Date: Wed, 27 Nov 2024 15:34:10 -0800 Subject: [PATCH 1/3] Fix spacing at top of OrderShipping#ship method Newest version of Rubocop wants us to remove extra spacing at the top of method bodies. --- core/app/models/spree/order_shipping.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/core/app/models/spree/order_shipping.rb b/core/app/models/spree/order_shipping.rb index e70ccd2b3bc..bfab5ecb910 100644 --- a/core/app/models/spree/order_shipping.rb +++ b/core/app/models/spree/order_shipping.rb @@ -44,7 +44,6 @@ def ship_shipment(shipment, external_number: nil, tracking_number: nil, suppress # @return The carton created. def ship(inventory_units:, stock_location:, address:, shipping_method:, shipped_at: Time.current, external_number: nil, tracking_number: nil, suppress_mailer: false) - carton = nil Spree::InventoryUnit.transaction do From 9a74fda94e3b86d31b01b0dd7f72406899888c1a Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Sat, 30 Nov 2024 15:47:27 +0100 Subject: [PATCH 2/3] Legacy Promotions: Remove unneeded decorator This is an artifact of the piece-by-piece extraction process I believe. Since is now done, we can remove this decorator. --- .../spree_promotion_code_batch_decorator.rb | 16 ---------------- .../app/models/spree/promotion_code_batch.rb | 9 +++++++++ 2 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb diff --git a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb deleted file mode 100644 index fdb8c85454b..00000000000 --- a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module SolidusLegacyPromotions - module SpreePromotionCodeBatchDecorator - def process - if state == "pending" - update!(state: "processing") - Spree::PromotionCodeBatchJob.perform_later(self) - else - raise Spree::PromotionCodeBatch::CantProcessStartedBatch.new("Batch #{id} already started") - end - end - - Spree::PromotionCodeBatch.prepend(self) - end -end diff --git a/legacy_promotions/app/models/spree/promotion_code_batch.rb b/legacy_promotions/app/models/spree/promotion_code_batch.rb index 66cbcc50d6a..85a17be14be 100644 --- a/legacy_promotions/app/models/spree/promotion_code_batch.rb +++ b/legacy_promotions/app/models/spree/promotion_code_batch.rb @@ -14,5 +14,14 @@ class CantProcessStartedBatch < StandardError def finished? state == "completed" end + + def process + if state == "pending" + update!(state: "processing") + PromotionCodeBatchJob.perform_later(self) + else + raise CantProcessStartedBatch.new("Batch #{id} already started") + end + end end end From 520efc0631bdf34c46f205aa63e632fabe7246db Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Sun, 1 Dec 2024 12:56:42 +0100 Subject: [PATCH 3/3] Test app task: Allow passing in user class Without this, every extension's test app always has `Spree::LegacyUser` configured. Mostly, that's fine, but for solidus_auth_devise, it'd be nicer if the generated spree.rb file would have `Spree.user_class = "Spree::User"` rather than `Spree::LegacyUser`. --- core/lib/spree/testing_support/extension_rake.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/spree/testing_support/extension_rake.rb b/core/lib/spree/testing_support/extension_rake.rb index f03d87ce527..4597fa4465a 100644 --- a/core/lib/spree/testing_support/extension_rake.rb +++ b/core/lib/spree/testing_support/extension_rake.rb @@ -4,8 +4,8 @@ desc "Generates a dummy app for testing an extension" namespace :extension do - task :test_app, [:user_class] do |_t, _args| + task :test_app, [:user_class] do |_t, args| Spree::DummyGeneratorHelper.inject_extension_requirements = true - Rake::Task['common:test_app'].invoke + Rake::Task['common:test_app'].invoke(args[:user_class]) end end