From 7bcb669773a31070519106fe0a5f63cac30ca8e3 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 22 Nov 2023 19:17:45 -0500 Subject: [PATCH] More fixture / model test --- test/fixtures/incomes.yml | 6 ++++++ test/models/income_test.rb | 2 +- test/models/member_test.rb | 26 +++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/test/fixtures/incomes.yml b/test/fixtures/incomes.yml index 16c5156..f6d8fb0 100644 --- a/test/fixtures/incomes.yml +++ b/test/fixtures/incomes.yml @@ -17,3 +17,9 @@ excluded: included: false amount: 10_000 member: one + +another_included: + description: Salary + included: true + amount: 10_000.00 + member: two diff --git a/test/models/income_test.rb b/test/models/income_test.rb index a582f18..2b682fe 100644 --- a/test/models/income_test.rb +++ b/test/models/income_test.rb @@ -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 diff --git a/test/models/member_test.rb b/test/models/member_test.rb index 4fec230..d98f1f5 100644 --- a/test/models/member_test.rb +++ b/test/models/member_test.rb @@ -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