fix: currency being ignored for properties (#1556)

* fix: add property with different currency is not updating

* fix: add property with different currency test

* fix: code review

* fix: code review
This commit is contained in:
Thiago Diniz da Silveira
2026-04-29 13:47:32 +02:00
committed by GitHub
parent 9b2c80768c
commit c9f9e04071
4 changed files with 40 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ class PropertiesControllerTest < ActionDispatch::IntegrationTest
account: {
name: "New Property",
subtype: "house",
currency: "EUR",
institution_name: "Property Lender",
institution_domain: "propertylender.example",
notes: "Property notes",
@@ -31,6 +32,7 @@ class PropertiesControllerTest < ActionDispatch::IntegrationTest
assert created_account.accountable.is_a?(Property)
assert_equal "draft", created_account.status
assert_equal 0, created_account.balance
assert_equal "EUR", created_account.currency
assert_equal "Property Lender", created_account[:institution_name]
assert_equal "propertylender.example", created_account[:institution_domain]
assert_equal "Property notes", created_account[:notes]
@@ -93,8 +95,12 @@ class PropertiesControllerTest < ActionDispatch::IntegrationTest
}
}
@account.reload
assert_equal 600000, @account.balance
assert_equal "EUR", @account.currency
# If account is active, it renders balances view; otherwise redirects to address
if @account.reload.active?
if @account.active?
assert_response :success
else
assert_redirected_to address_property_path(@account)