1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00
Maybe/test/controllers/accounts_controller_test.rb

38 lines
903 B
Ruby
Raw Normal View History

require "test_helper"
class AccountsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in @user = users(:family_admin)
@account = accounts(:depository)
end
test "should get index" do
get accounts_url
assert_response :success
end
test "should sync account" do
post sync_account_url(@account)
assert_redirected_to account_url(@account)
end
test "should get chart" do
get chart_account_url(@account)
assert_response :success
end
test "should get sparkline" do
get sparkline_account_url(@account)
assert_response :success
end
test "should handle sparkline errors gracefully" do
# Mock an error in the sparkline_series method
@account.stubs(:sparkline_series).raises(StandardError.new("Test error"))
get sparkline_account_url(@account)
assert_response :success
assert_match /Error/, response.body
2024-06-13 17:03:38 -04:00
end
end