Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Spec for "Recalculate payment total when order total decreases"
Browse files Browse the repository at this point in the history
  • Loading branch information
dholdren committed Dec 31, 2017
1 parent 50e86bc commit c0ea570
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec/models/solidus_paypal_braintree/transaction_import_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,31 @@
expect(order.payments.first.amount).to eq 16
end
end

context 'with a less expensive tax category' do
before do
original_zone = Spree::Zone.create name: 'first address tax'
original_zone.members << Spree::ZoneMember.new(zoneable: address.state)
original_tax_rate = create :tax_rate, zone: original_zone, amount: 0.2

# new address is NY
ny_zone = Spree::Zone.create name: 'nyc tax'
ny_zone.members << Spree::ZoneMember.new(zoneable: new_york)
create :tax_rate, tax_category: original_tax_rate.tax_category, zone: ny_zone, amount: 0.1
end

it 'includes the lower tax in the payment' do
# so shipments and shipment cost is calculated before transaction import
order.next!; order.next!
# precondition
expect(order.additional_tax_total).to eq 2
expect(order.total).to eq 17

subject
expect(order.additional_tax_total).to eq 1
expect(order.payments.first.amount).to eq 16
end
end
end
end

Expand Down

0 comments on commit c0ea570

Please sign in to comment.