mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Account Activity View + Account Forms (#1406)
* Remove balance mode, sketch out refactor * Activity view checkpoint * Entry partials, checkpoint * Finish txn partial * Give entries context when editing for different turbo responses * Calculate change of balance for each entry * Account tabs consolidation * Translations, linting, brakeman updates * Account actions concern * Finalize forms, get account system tests passing * Get tests passing * Lint, rubocop, schema updates * Improve routing and stream responses * Fix broken routes * Add import option for adding accounts * Fix system test * Fix test specificity * Fix sparklines * Improve account redirects
This commit is contained in:
parent
12e4f1067d
commit
65db49273c
216 changed files with 2043 additions and 1620 deletions
|
@ -1,12 +1,14 @@
|
|||
require "test_helper"
|
||||
|
||||
class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
||||
include AccountableResourceInterfaceTest
|
||||
|
||||
setup do
|
||||
sign_in @user = users(:family_admin)
|
||||
@account = accounts(:credit_card)
|
||||
end
|
||||
|
||||
test "creates credit card" do
|
||||
test "creates with credit card details" do
|
||||
assert_difference -> { Account.count } => 1,
|
||||
-> { CreditCard.count } => 1,
|
||||
-> { Account::Valuation.count } => 2,
|
||||
|
@ -17,8 +19,6 @@ class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
|||
balance: 1000,
|
||||
currency: "USD",
|
||||
accountable_type: "CreditCard",
|
||||
start_date: 1.month.ago.to_date,
|
||||
start_balance: 0,
|
||||
accountable_attributes: {
|
||||
available_credit: 5000,
|
||||
minimum_payment: 25,
|
||||
|
@ -35,20 +35,20 @@ class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal "New Credit Card", created_account.name
|
||||
assert_equal 1000, created_account.balance
|
||||
assert_equal "USD", created_account.currency
|
||||
assert_equal 5000, created_account.credit_card.available_credit
|
||||
assert_equal 25, created_account.credit_card.minimum_payment
|
||||
assert_equal 15.99, created_account.credit_card.apr
|
||||
assert_equal 2.years.from_now.to_date, created_account.credit_card.expiration_date
|
||||
assert_equal 99, created_account.credit_card.annual_fee
|
||||
assert_equal 5000, created_account.accountable.available_credit
|
||||
assert_equal 25, created_account.accountable.minimum_payment
|
||||
assert_equal 15.99, created_account.accountable.apr
|
||||
assert_equal 2.years.from_now.to_date, created_account.accountable.expiration_date
|
||||
assert_equal 99, created_account.accountable.annual_fee
|
||||
|
||||
assert_redirected_to account_path(created_account)
|
||||
assert_equal "Credit card created successfully", flash[:notice]
|
||||
assert_redirected_to created_account
|
||||
assert_equal "Credit card account created", flash[:notice]
|
||||
assert_enqueued_with(job: AccountSyncJob)
|
||||
end
|
||||
|
||||
test "updates credit card" do
|
||||
test "updates with credit card details" do
|
||||
assert_no_difference [ "Account.count", "CreditCard.count" ] do
|
||||
patch credit_card_path(@account), params: {
|
||||
patch account_path(@account), params: {
|
||||
account: {
|
||||
name: "Updated Credit Card",
|
||||
balance: 2000,
|
||||
|
@ -70,14 +70,14 @@ class CreditCardsControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert_equal "Updated Credit Card", @account.name
|
||||
assert_equal 2000, @account.balance
|
||||
assert_equal 6000, @account.credit_card.available_credit
|
||||
assert_equal 50, @account.credit_card.minimum_payment
|
||||
assert_equal 14.99, @account.credit_card.apr
|
||||
assert_equal 3.years.from_now.to_date, @account.credit_card.expiration_date
|
||||
assert_equal 0, @account.credit_card.annual_fee
|
||||
assert_equal 6000, @account.accountable.available_credit
|
||||
assert_equal 50, @account.accountable.minimum_payment
|
||||
assert_equal 14.99, @account.accountable.apr
|
||||
assert_equal 3.years.from_now.to_date, @account.accountable.expiration_date
|
||||
assert_equal 0, @account.accountable.annual_fee
|
||||
|
||||
assert_redirected_to account_path(@account)
|
||||
assert_equal "Credit card updated successfully", flash[:notice]
|
||||
assert_redirected_to @account
|
||||
assert_equal "Credit card account updated", flash[:notice]
|
||||
assert_enqueued_with(job: AccountSyncJob)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue