mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Account namespace updates: part 1 (#893)
* Rename accountable types * Merge conflicts * Fix broken tests * Add back sidebar changes
This commit is contained in:
parent
778098ebb0
commit
a947db92b2
54 changed files with 349 additions and 184 deletions
77
test/system/accounts_test.rb
Normal file
77
test/system/accounts_test.rb
Normal file
|
@ -0,0 +1,77 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class AccountsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in @user = users(:family_admin)
|
||||
|
||||
visit root_url
|
||||
open_new_account_modal
|
||||
end
|
||||
|
||||
test "can create depository account" do
|
||||
assert_account_created("Depository")
|
||||
end
|
||||
|
||||
test "can create investment account" do
|
||||
assert_account_created("Investment")
|
||||
end
|
||||
|
||||
test "can create crypto account" do
|
||||
assert_account_created("Crypto")
|
||||
end
|
||||
|
||||
test "can create property account" do
|
||||
assert_account_created("Property")
|
||||
end
|
||||
|
||||
test "can create vehicle account" do
|
||||
assert_account_created("Vehicle")
|
||||
end
|
||||
|
||||
test "can create other asset account" do
|
||||
assert_account_created("OtherAsset")
|
||||
end
|
||||
|
||||
test "can create credit card account" do
|
||||
assert_account_created("CreditCard")
|
||||
end
|
||||
|
||||
test "can create loan account" do
|
||||
assert_account_created("Loan")
|
||||
end
|
||||
|
||||
test "can create other liability account" do
|
||||
assert_account_created("OtherLiability")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def open_new_account_modal
|
||||
click_link "sidebar-new-account"
|
||||
end
|
||||
|
||||
def assert_account_created(accountable_type)
|
||||
click_link humanized_accountable(accountable_type)
|
||||
click_link "Enter account balance manually"
|
||||
|
||||
account_name = "[system test] #{accountable_type} Account"
|
||||
|
||||
fill_in "Account name", with: account_name
|
||||
select "Chase", from: "Financial institution"
|
||||
fill_in "account[balance]", with: 100.99
|
||||
check "Add a start balance for this account"
|
||||
fill_in "Start date (optional)", with: 10.days.ago.to_date.to_s
|
||||
fill_in "Start balance (optional)", with: 95
|
||||
click_button "Add #{humanized_accountable(accountable_type).downcase}"
|
||||
|
||||
find("details", text: humanized_accountable(accountable_type)).click
|
||||
assert_text account_name
|
||||
|
||||
visit accounts_url
|
||||
assert_text account_name
|
||||
end
|
||||
|
||||
def humanized_accountable(accountable_type)
|
||||
accountable_type.constantize.model_name.human
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue