Skip to content

Commit

Permalink
Merge pull request solidusio#5729 from mamhoff/add-shipping-promotion…
Browse files Browse the repository at this point in the history
…-handler-to-null-configuration

Add `shipping_promotion_handler_class` attribute to null promo config
  • Loading branch information
kennyadsl authored Apr 19, 2024
2 parents 68b294f + 4187f51 commit eda3961
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 eda3961

Please sign in to comment.