Andrew Tomaka
e1a7f4fbbd
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #9
39 lines
926 B
Ruby
39 lines
926 B
Ruby
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
|
|
end
|