Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit

Permalink
Fix shipping rate discount factory
Browse files Browse the repository at this point in the history
This factory would violate a not-null constraint.
  • Loading branch information
mamhoff committed Oct 25, 2023
1 parent dc96005 commit 3363f3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
factory :friendly_shipping_rate_discount, class: "SolidusFriendlyPromotions::ShippingRateDiscount" do
amount { BigDecimal("-4.00") }
shipping_rate
promotion_action { SolidusFriendlyPromotions::Actions::AdjustShipment.new }
promotion_action do
promotion = create(:friendly_promotion, name: "10% off shipping!", customer_label: "10% off")
ten_percent = SolidusFriendlyPromotions::Calculators::Percent.new(preferred_percent: 10)
SolidusFriendlyPromotions::Actions::AdjustShipment.create!(promotion: promotion, calculator: ten_percent)
end
label { "10% off" }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
:friendly_promotion_with_first_order_rule,
:friendly_promotion_with_item_adjustment,
:friendly_promotion_with_item_total_rule,
:friendly_promotion_with_order_adjustment
:friendly_promotion_with_order_adjustment,
:friendly_shipping_rate_discount
].each do |factory|
expect { FactoryBot.create(factory) }.not_to raise_exception
end
Expand Down

0 comments on commit 3363f3a

Please sign in to comment.