Skip to content

Commit

Permalink
Remove deprecated Spree::PromotionRule#for
Browse files Browse the repository at this point in the history
Please select promotion rules by their applicable status on
the promotable instead.

Ref solidusio#4284
  • Loading branch information
kennyadsl committed Mar 27, 2023
1 parent e27f779 commit a8c0735
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
5 changes: 0 additions & 5 deletions core/app/models/spree/promotion_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ def preload_relations
[]
end

def self.for(promotable)
all.select { |rule| rule.applicable?(promotable) }
end
deprecate :for, "Please select promotion rules by their applicable status on the promotable instead."

def applicable?(_promotable)
raise NotImplementedError, "applicable? should be implemented in a sub-class of Spree::PromotionRule"
end
Expand Down
1 change: 0 additions & 1 deletion core/spec/models/spree/promotion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@

it "true if there are no applicable rules" do
promotion.promotion_rules = [stub_model(Spree::PromotionRule, eligible?: true, applicable?: false)]
allow(promotion.promotion_rules).to receive(:for).and_return([])
expect(promotion.eligible_rules(promotable)).to eq []
end

Expand Down

0 comments on commit a8c0735

Please sign in to comment.