mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update CheckoutHelper
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user