Update CheckoutHelper

This commit is contained in:
Matt-Yorkley
2021-02-10 20:08:28 +00:00
parent f0aa43e198
commit 02fb2c6a55
2 changed files with 3 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ module CheckoutHelper
adjustments = order.adjustments.eligible
exclude = opts[:exclude] || {}
adjustments = adjustments.to_a
adjustments = adjustments.to_a + order.shipment_adjustments.to_a
# Remove empty tax adjustments and (optionally) shipping fees
adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' && a.amount == 0 }

View File

@@ -41,14 +41,14 @@ describe CheckoutHelper, type: :helper do
before do
# Sanity check initial adjustments state
expect(order.adjustments.shipping.count).to eq 1
expect(order.shipment_adjustments.count).to eq 1
expect(order.adjustments.enterprise_fee.count).to eq 1
end
it "collects adjustments on the order" do
adjustments = helper.checkout_adjustments_for(order)
shipping_adjustment = order.adjustments.shipping.first
shipping_adjustment = order.shipment_adjustments.first
expect(adjustments).to include shipping_adjustment
admin_fee_summary = adjustments.last