Skip to content

Commit

Permalink
Add missing test to consider refunds on Payment#credit_allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
waiting-for-dev committed Apr 12, 2023
1 parent d46130e commit 83f1dc6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/spec/models/spree/payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,14 @@
create(:payment, amount: -80, source: payment, source_type: 'Spree::Payment', state: 'completed', payment_method: create(:check_payment_method))
expect(payment.credit_allowed).to eq(20)
end

it "is the difference between refunds total and payment amount" do
payment.amount = 100

expect {
create(:refund, payment: payment, amount: 80)
}.to change { payment.credit_allowed }.from(100).to(20)
end
end

describe "#can_credit?" do
Expand Down

0 comments on commit 83f1dc6

Please sign in to comment.