mirror of
https://github.com/we-promise/sure.git
synced 2026-06-09 12:49:01 +00:00
Fix loan account subtype not persisting on create (#1491)
* Fix loan account subtype not persisting on create The LoansController was missing :subtype in permitted_accountable_attributes, causing form submissions with account[subtype] to be silently ignored. This is the same bug that was fixed for Investment accounts in PR #1039 and Crypto accounts in PR #1022. Fixes: loan account subtype not saving (v0.7.0-alpha.4) * Validate loan subtype values Agent-Logs-Url: https://github.com/we-promise/sure/sessions/54bc6874-2cc0-43aa-ac44-9acd50316be3 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com> --------- Co-authored-by: SureBot <sure-bot@we-promise.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,7 @@ class LoansControllerTest < ActionDispatch::IntegrationTest
|
||||
notes: "Mortgage notes",
|
||||
accountable_type: "Loan",
|
||||
accountable_attributes: {
|
||||
subtype: "mortgage",
|
||||
interest_rate: 5.5,
|
||||
term_months: 60,
|
||||
rate_type: "fixed",
|
||||
@@ -40,6 +41,7 @@ class LoansControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal "Local Bank", created_account[:institution_name]
|
||||
assert_equal "localbank.example", created_account[:institution_domain]
|
||||
assert_equal "Mortgage notes", created_account[:notes]
|
||||
assert_equal "mortgage", created_account.accountable.subtype
|
||||
assert_equal 5.5, created_account.accountable.interest_rate
|
||||
assert_equal 60, created_account.accountable.term_months
|
||||
assert_equal "fixed", created_account.accountable.rate_type
|
||||
@@ -63,6 +65,7 @@ class LoansControllerTest < ActionDispatch::IntegrationTest
|
||||
accountable_type: "Loan",
|
||||
accountable_attributes: {
|
||||
id: @account.accountable_id,
|
||||
subtype: "auto",
|
||||
interest_rate: 4.5,
|
||||
term_months: 48,
|
||||
rate_type: "fixed",
|
||||
@@ -79,6 +82,7 @@ class LoansControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal "Updated Bank", @account[:institution_name]
|
||||
assert_equal "updatedbank.example", @account[:institution_domain]
|
||||
assert_equal "Updated loan notes", @account[:notes]
|
||||
assert_equal "auto", @account.accountable.subtype
|
||||
assert_equal 4.5, @account.accountable.interest_rate
|
||||
assert_equal 48, @account.accountable.term_months
|
||||
assert_equal "fixed", @account.accountable.rate_type
|
||||
|
||||
Reference in New Issue
Block a user