Skip to content

Commit

Permalink
Add shipping_promotion_handler_class attribute to null promo config
Browse files Browse the repository at this point in the history
We have a shipping_promotion_handler_class in the legacy promotion
system, and we have calling code from Solidus itself, so we need to add
this configuration option to the null promotion configuration, too.
  • Loading branch information
mamhoff committed Apr 18, 2024
1 parent 7ba0f98 commit 4187f51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/lib/spree/core/null_promotion_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ class NullPromotionConfiguration < Spree::Preferences::Configuration
# Spree::NullPromotionFinder.
class_name_attribute :promotion_finder_class, default: 'Spree::NullPromotionFinder'

# Allows providing a different promotion shipping promotion handler.
# @!attribute [rw] shipping_promotion_handler_class
# @see Spree::NullPromotionHandler
# @return [Class] an object that conforms to the API of
# the standard promotion finder class
# Spree::NullPromotionHandler.
class_name_attribute :shipping_promotion_handler_class, default: 'Spree::NullPromotionHandler'

# !@attribute [rw] promotion_api_attributes
# @return [Array<Symbol>] Attributes to be returned by the API for a promotion
preference :promotion_api_attributes, :array, default: []
Expand Down
4 changes: 4 additions & 0 deletions core/spec/lib/spree/core/null_promotion_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
it "uses the null promotion finder class by default" do
expect(config.promotion_finder_class).to eq Spree::NullPromotionFinder
end

it "uses the null promotion handler as the shipping promo handler" do
expect(config.shipping_promotion_handler_class).to eq Spree::NullPromotionHandler
end
end

0 comments on commit 4187f51

Please sign in to comment.