Skip to content

Commit

Permalink
Added spec for refunds not updating balance due
Browse files Browse the repository at this point in the history
Created a spec to simulate the behavior listed in solidusio#1475 in order
to properly fix the issue.
  • Loading branch information
ericsaupe authored and jhawthorn committed Jun 7, 2017
1 parent 3e48840 commit 63fe5fc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@
end
end

context '#outstanding_balance' do
let(:order) { create(:order_ready_to_ship, line_items_count: 3) }
let(:payment) { order.payments.first }

it "should handle refunds properly" do
order.cancellations.short_ship([order.inventory_units.first])
expect(order.outstanding_balance).to be_negative
expect(order.payment_state).to eq('credit_owed')
create(:refund, amount: order.outstanding_balance.abs, payment: payment, transaction_id: nil)
expect(order.outstanding_balance).to eq(0)
expect(order.payment_state).to eq('paid')
end
end

context "#display_outstanding_balance" do
it "returns the value as a spree money" do
allow(order).to receive(:outstanding_balance) { 10.55 }
Expand Down

0 comments on commit 63fe5fc

Please sign in to comment.