Skip to content

Commit

Permalink
Use Null Promotion Configuration in core
Browse files Browse the repository at this point in the history
We want to use the legacy `Spree::PromotionConfiguration` in the
solidus_legacy_promotions test suite.
  • Loading branch information
mamhoff committed May 29, 2024
1 parent f9e0446 commit bb52430
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def stock
# the standard promotion configuration class Spree::Core::PromotionConfiguration.
attr_writer :promotions
def promotions
@promotions ||= Spree::Core::PromotionConfiguration.new
@promotions ||= Spree::Core::NullPromotionConfiguration.new
end

class << self
Expand Down
14 changes: 7 additions & 7 deletions core/spec/lib/spree/app_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

it "uses core's promotion configuration class by default" do
expect(prefs.promotions).to be_a Spree::Core::PromotionConfiguration
expect(prefs.promotions).to be_a Spree::Core::NullPromotionConfiguration
end

context "deprecated preferences" do
Expand All @@ -52,23 +52,23 @@
end

it "uses order adjustments recalculator class by default" do
expect(prefs.promotion_adjuster_class).to eq Spree::Promotion::OrderAdjustmentsRecalculator
expect(prefs.promotion_adjuster_class).to eq Spree::NullPromotionAdjuster
end

it "uses promotion handler coupon class by default" do
expect(prefs.coupon_code_handler_class).to eq Spree::PromotionHandler::Coupon
expect(prefs.coupon_code_handler_class).to eq Spree::NullPromotionHandler
end

it "uses promotion handler shipping class by default" do
expect(prefs.shipping_promotion_handler_class).to eq Spree::PromotionHandler::Shipping
expect(prefs.shipping_promotion_handler_class).to eq Spree::NullPromotionHandler
end

it "uses promotion code batch mailer class by default" do
expect(prefs.promotion_code_batch_mailer_class).to eq Spree::PromotionCodeBatchMailer
expect(prefs.promotion_code_batch_mailer_class).to eq Spree::DeprecatedConfigurableClass
end

it "uses promotion chooser class by default" do
expect(prefs.promotion_chooser_class).to eq Spree::PromotionChooser
expect(prefs.promotion_chooser_class).to eq Spree::DeprecatedConfigurableClass
end
end

Expand Down Expand Up @@ -113,7 +113,7 @@

describe '#promotions' do
subject { prefs.promotions }
it { is_expected.to be_a Spree::Core::PromotionConfiguration }
it { is_expected.to be_a Spree::Core::NullPromotionConfiguration }
end

describe '@default_country_iso_code' do
Expand Down

0 comments on commit bb52430

Please sign in to comment.