2024-02-05 11:00:40 +11:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class AccountsControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
setup do
|
2024-02-27 12:43:49 -05:00
|
|
|
sign_in @user = users(:family_admin)
|
2024-07-10 11:22:59 -04:00
|
|
|
@account = accounts(:depository)
|
2024-02-05 11:00:40 +11:00
|
|
|
end
|
|
|
|
|
2024-06-13 14:37:27 -04:00
|
|
|
test "gets accounts list" do
|
|
|
|
get accounts_url
|
|
|
|
assert_response :success
|
|
|
|
|
2024-11-15 13:49:37 -05:00
|
|
|
@user.family.accounts.manual.each do |account|
|
2024-06-13 14:37:27 -04:00
|
|
|
assert_dom "#" + dom_id(account), count: 1
|
|
|
|
end
|
2024-11-15 13:49:37 -05:00
|
|
|
|
|
|
|
@user.family.plaid_items.each do |item|
|
|
|
|
assert_dom "#" + dom_id(item), count: 1
|
|
|
|
end
|
2024-06-13 14:37:27 -04:00
|
|
|
end
|
|
|
|
|
2024-02-05 11:00:40 +11:00
|
|
|
test "new" do
|
|
|
|
get new_account_path
|
|
|
|
assert_response :ok
|
|
|
|
end
|
|
|
|
|
2024-06-13 17:03:38 -04:00
|
|
|
test "can sync an account" do
|
|
|
|
post sync_account_path(@account)
|
2024-11-15 13:49:37 -05:00
|
|
|
assert_redirected_to account_path(@account)
|
2024-06-13 17:03:38 -04:00
|
|
|
end
|
|
|
|
|
2024-07-05 13:36:18 +02:00
|
|
|
test "can sync all accounts" do
|
|
|
|
post sync_all_accounts_path
|
2024-11-15 13:49:37 -05:00
|
|
|
assert_redirected_to accounts_path
|
2024-07-05 13:36:18 +02:00
|
|
|
end
|
2024-02-05 11:00:40 +11:00
|
|
|
end
|