Skip to content

Commit ac0f616

Browse files
committed
Make #discounts_by_lanes private
1 parent 2ddd81a commit ac0f616

File tree

4 files changed

+4
-72
lines changed

4 files changed

+4
-72
lines changed

promotions/app/models/concerns/solidus_promotions/adjustment_discounts.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module SolidusPromotions
44
module AdjustmentDiscounts
5+
private
6+
57
def discounts_by_lanes(lanes)
68
adjustments.select do |adjustment|
79
!adjustment.marked_for_destruction? &&

promotions/app/patches/models/solidus_promotions/shipping_rate_patch.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def promo_total
2323
discounts.sum(&:amount)
2424
end
2525

26+
private
27+
2628
def discounts_by_lanes(lanes)
2729
discounts.select do |discount|
2830
!discount.marked_for_destruction? &&

promotions/spec/models/spree/line_item_spec.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,6 @@
2424
end
2525
end
2626

27-
describe "#discounts_by_lanes" do
28-
let(:tax_rate) { create(:tax_rate) }
29-
let(:pre_lane_promotion) { create(:solidus_promotion, :with_adjustable_benefit, lane: :pre) }
30-
let(:post_lane_promotion) { create(:solidus_promotion, :with_adjustable_benefit, lane: :post) }
31-
let(:line_item) { Spree::LineItem.new(adjustments:) }
32-
let(:adjustments) { [tax_adjustment, pre_lane_adjustment, post_lane_adjustment] }
33-
let(:tax_adjustment) { Spree::Adjustment.new(source: tax_rate, amount: 2) }
34-
let(:pre_lane_adjustment) { Spree::Adjustment.new(source: pre_lane_promotion.benefits.first) }
35-
let(:post_lane_adjustment) { Spree::Adjustment.new(source: post_lane_promotion.benefits.first) }
36-
37-
subject { line_item.discounts_by_lanes(lanes) }
38-
39-
context "if lanes is empty" do
40-
let(:lanes) { [] }
41-
it { is_expected.to be_empty }
42-
end
43-
44-
context "if lanes is all lanes" do
45-
let(:lanes) { SolidusPromotions::PromotionLane.ordered }
46-
47-
it { is_expected.to contain_exactly(pre_lane_adjustment, post_lane_adjustment) }
48-
end
49-
50-
context "if lanes is only pre lane" do
51-
let(:lanes) { [:pre] }
52-
53-
it { is_expected.to contain_exactly(pre_lane_adjustment) }
54-
end
55-
56-
context "if lanes is only default lane" do
57-
let(:lanes) { [:default] }
58-
59-
it { is_expected.to be_empty }
60-
end
61-
end
62-
6327
describe "#reset_current_discounts" do
6428
let(:line_item) { Spree::LineItem.new }
6529

promotions/spec/models/spree/shipment_spec.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,6 @@
3737
end
3838
end
3939

40-
describe "#discounts_by_lanes" do
41-
let(:tax_rate) { create(:tax_rate) }
42-
let(:pre_lane_promotion) { create(:solidus_promotion, :with_adjustable_benefit, lane: :pre) }
43-
let(:post_lane_promotion) { create(:solidus_promotion, :with_adjustable_benefit, lane: :post) }
44-
let(:shipment) { Spree::Shipment.new(adjustments:) }
45-
let(:adjustments) { [tax_adjustment, pre_lane_adjustment, post_lane_adjustment] }
46-
let(:tax_adjustment) { Spree::Adjustment.new(source: tax_rate, amount: 2) }
47-
let(:pre_lane_adjustment) { Spree::Adjustment.new(source: pre_lane_promotion.benefits.first) }
48-
let(:post_lane_adjustment) { Spree::Adjustment.new(source: post_lane_promotion.benefits.first) }
49-
50-
subject { shipment.discounts_by_lanes(lanes) }
51-
52-
context "if lanes is empty" do
53-
let(:lanes) { [] }
54-
it { is_expected.to be_empty }
55-
end
56-
57-
context "if lanes is all lanes" do
58-
let(:lanes) { SolidusPromotions::PromotionLane.ordered }
59-
60-
it { is_expected.to contain_exactly(pre_lane_adjustment, post_lane_adjustment) }
61-
end
62-
63-
context "if lanes is only pre lane" do
64-
let(:lanes) { [:pre] }
65-
66-
it { is_expected.to contain_exactly(pre_lane_adjustment) }
67-
end
68-
69-
context "if lanes is only default lane" do
70-
let(:lanes) { [:default] }
71-
72-
it { is_expected.to be_empty }
73-
end
74-
end
75-
7640
describe "#previous_lane_discounts" do
7741
let(:order) { Spree::Order.new }
7842
let(:tax_rate) { create(:tax_rate) }

0 commit comments

Comments
 (0)