mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Allow transfers based on transactions in different currencies (#903)
* Allow transfers between transactions in different currencies * Review fixes
This commit is contained in:
parent
12380dc8ad
commit
3cae528dfd
2 changed files with 14 additions and 2 deletions
|
@ -39,11 +39,18 @@ class Account::TransferTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "transfer transactions must net to zero" do
|
||||
test "single-currency transfer transactions must net to zero" do
|
||||
@outflow.update! amount: 105
|
||||
|
||||
assert_raises ActiveRecord::RecordInvalid do
|
||||
Account::Transfer.create! transactions: [ @inflow, @outflow ]
|
||||
end
|
||||
end
|
||||
|
||||
test "multi-currency transfer transactions do not have to net to zero" do
|
||||
@outflow.update! amount: 105, currency: "EUR"
|
||||
transfer = Account::Transfer.create! transactions: [ @inflow, @outflow ]
|
||||
|
||||
assert transfer.valid?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue