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
|
|
|
|
|
2025-05-26 20:05:16 -05:00
|
|
|
test "should get index" do
|
|
|
|
get accounts_url
|
|
|
|
assert_response :success
|
2024-02-05 11:00:40 +11:00
|
|
|
end
|
|
|
|
|
2025-07-18 05:52:18 -04:00
|
|
|
test "should get show" do
|
|
|
|
get account_url(@account)
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
2025-05-26 20:05:16 -05:00
|
|
|
test "should sync account" do
|
|
|
|
post sync_account_url(@account)
|
|
|
|
assert_redirected_to account_url(@account)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get sparkline" do
|
|
|
|
get sparkline_account_url(@account)
|
|
|
|
assert_response :success
|
|
|
|
end
|
2025-07-18 05:52:18 -04:00
|
|
|
|
|
|
|
test "destroys account" do
|
|
|
|
delete account_url(@account)
|
|
|
|
assert_redirected_to accounts_path
|
|
|
|
assert_enqueued_with job: DestroyJob
|
|
|
|
assert_equal "Account scheduled for deletion", flash[:notice]
|
|
|
|
end
|
2024-02-05 11:00:40 +11:00
|
|
|
end
|