Compare commits

..

No commits in common. "6272fd7cf903989a5560d455daaca1f861fac08a" and "dd881ee41c7f2f65f0909d1e9706a9eae201c3c2" have entirely different histories.

11 changed files with 37 additions and 113 deletions

View file

@ -2,7 +2,7 @@ require "test_helper"
class ExpensesControllerTest < ActionDispatch::IntegrationTest class ExpensesControllerTest < ActionDispatch::IntegrationTest
setup do setup do
@expense = expenses(:monthly_expense) @expense = expenses(:one)
end end
test "should get index" do test "should get index" do

View file

@ -2,7 +2,7 @@ require "test_helper"
class IncomesControllerTest < ActionDispatch::IntegrationTest class IncomesControllerTest < ActionDispatch::IntegrationTest
setup do setup do
@income = incomes(:included_1) @income = incomes(:one)
end end
test "should get index" do test "should get index" do

View file

@ -1,5 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one: one:
description: Credit Card Bill One description: MyString
amount: 1_000.00 amount: 9.99
two:
description: MyString
amount: 9.99

View file

@ -1,29 +1,15 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
monthly_expense: one:
description: Monthly Expense description: MyString
payment: 120.00 payment: 9.99
period: monthly period: 1
credit_card: true
estimated: false
annual_expense:
description: Annual Expense
payment: 120.00
period: annually
credit_card: true
estimated: false
weekly_expense:
description: Weekly Expense
payment: 120.00
period: weekly
credit_card: false credit_card: false
estimated: false estimated: false
quarterly_expense: two:
description: Quarterly Expense description: MyString
payment: 120.00 payment: 9.99
period: quarterly period: 1
credit_card: false credit_card: false
estimated: false estimated: false

View file

@ -1,25 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
included_1: one:
description: Salary description: MyString
included: true
amount: 85_000.00
member: one
included_2:
description: Salary
included: true
amount: 15_000.00
member: one
excluded:
description: Bonus
included: false included: false
amount: 10_000 amount: 9.99
member: one member: one
another_included: two:
description: Salary description: MyString
included: true included: false
amount: 10_000.00 amount: 9.99
member: two member: two

View file

@ -1,9 +1,7 @@
require "test_helper" require "test_helper"
class CreditCardBillTest < ActiveSupport::TestCase class CreditCardBillTest < ActiveSupport::TestCase
def test_unpaid # test "the truth" do
credit_card_bill = credit_card_bills(:one) # assert true
# end
assert_equal 870.00, credit_card_bill.unpaid
end
end end

View file

@ -1,39 +1,7 @@
require "test_helper" require "test_helper"
class ExpenseTest < ActiveSupport::TestCase class ExpenseTest < ActiveSupport::TestCase
def test_monthly_converts_period_for_monthly # test "the truth" do
expense = expenses(:monthly_expense) # assert true
# end
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 end

View file

@ -1,7 +1,7 @@
require "test_helper" require "test_helper"
class IncomeTest < ActiveSupport::TestCase class IncomeTest < ActiveSupport::TestCase
def test_total # test "the truth" do
assert_equal 110_000.00, Income.total # assert true
end # end
end end

View file

@ -1,27 +1,7 @@
require "test_helper" require "test_helper"
class MemberTest < ActiveSupport::TestCase class MemberTest < ActiveSupport::TestCase
def member # test "the truth" do
members(:one) # assert true
end # 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 end

View file

@ -2,7 +2,7 @@ require "application_system_test_case"
class ExpensesTest < ApplicationSystemTestCase class ExpensesTest < ApplicationSystemTestCase
setup do setup do
@expense = expenses(:monthly_expense) @expense = expenses(:one)
end end
test "visiting the index" do test "visiting the index" do

View file

@ -2,7 +2,7 @@ require "application_system_test_case"
class IncomesTest < ApplicationSystemTestCase class IncomesTest < ApplicationSystemTestCase
setup do setup do
@income = incomes(:included_1) @income = incomes(:one)
end end
test "visiting the index" do test "visiting the index" do