budget/test/models/expense_test.rb

40 lines
926 B
Ruby
Raw Permalink Normal View History

2022-11-20 15:43:33 -05:00
require "test_helper"
class ExpenseTest < ActiveSupport::TestCase
def test_monthly_converts_period_for_monthly
expense = expenses(:monthly_expense)
assert_equal 120.00, expense.monthly
end
def test_monthly_converts_period_for_annually
expense = expenses(:annual_expense)
assert_equal 10.00, expense.monthly
end
def test_monthly_converts_period_for_weekly
expense = expenses(:weekly_expense)
assert_equal 520.00, expense.monthly
end
def test_monthly_converts_period_for_quarterly
expense = expenses(:quarterly_expense)
assert_equal 40.00, expense.monthly
end
def test_total_calculates_total_of_expenses
assert_equal 480.00, Expense.total
end
def test_total_calculates_monthly_total
assert_equal 690.00, Expense.monthly_total
end
def test_total_calculates_credit_card_monthly_total
assert_equal 130.00, Expense.credit_card_monthly_total
end
2022-11-20 15:43:33 -05:00
end