Add some model tests #9
3 changed files with 30 additions and 4 deletions
6
test/fixtures/incomes.yml
vendored
6
test/fixtures/incomes.yml
vendored
|
@ -17,3 +17,9 @@ excluded:
|
|||
included: false
|
||||
amount: 10_000
|
||||
member: one
|
||||
|
||||
another_included:
|
||||
description: Salary
|
||||
included: true
|
||||
amount: 10_000.00
|
||||
member: two
|
||||
|
|
|
@ -2,6 +2,6 @@ require "test_helper"
|
|||
|
||||
class IncomeTest < ActiveSupport::TestCase
|
||||
def test_total
|
||||
assert_equal 100_000.00, Income.total
|
||||
assert_equal 110_000.00, Income.total
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,27 @@
|
|||
require "test_helper"
|
||||
|
||||
class MemberTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
def member
|
||||
members(:one)
|
||||
end
|
||||
|
||||
def test_income
|
||||
assert_equal 110_000.00, member.income
|
||||
end
|
||||
|
||||
def test_included_income
|
||||
assert_equal 100_000.00, member.included_income
|
||||
end
|
||||
|
||||
def test_others_included_income
|
||||
assert_equal 10_000.00, member.others_included_income
|
||||
end
|
||||
|
||||
def test_burden_percent
|
||||
assert_equal 0.91, member.burden_percent
|
||||
end
|
||||
|
||||
def test_burden_amount
|
||||
assert_equal 627.90, member.burden_amount
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue