Skip to content

Commit

Permalink
Merge pull request #54 from friendlycart/fix-shipping-rate-discount-f…
Browse files Browse the repository at this point in the history
…actory

Fix shipping rate discount factory
  • Loading branch information
mamhoff authored Oct 25, 2023
2 parents f365e65 + 3363f3a commit db11fc2
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 db11fc2

Please sign in to comment.