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
|
|
|
|
|
|
|
|
@user.family.accounts.each do |account|
|
|
|
|
assert_dom "#" + dom_id(account), count: 1
|
|
|
|
end
|
|
|
|
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-07-18 14:39:38 -04:00
|
|
|
assert_response :no_content
|
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
|
|
|
|
assert_redirected_to accounts_url
|
2024-07-10 11:22:59 -04:00
|
|
|
assert_equal "Successfully queued accounts for syncing.", flash[:notice]
|
2024-07-05 13:36:18 +02:00
|
|
|
end
|
2024-02-05 11:00:40 +11:00
|
|
|
end
|