Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubkottnauer committed May 13, 2024
1 parent 173a670 commit 0cbdb80
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
1 change: 1 addition & 0 deletions lib/tasks/demo_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace :demo_data do
personal_iou = Account.create(name: "Demo Personal IOU", family: family, accountable: Account::OtherLiability.new, balance: 1000, currency: "USD")
second_car = Account.create(name: "Demo Secondary Car", family: family, accountable: Account::Vehicle.new, balance: 12000, currency: "USD")


# ========== Transactions ================
multi_currency_checking_transactions = [
{ date: Date.today - 45, amount: 3000, name: "Paycheck", currency: "USD" },
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ manual_with_valuation_overrides:
balance: 1000
start_balance: 1000
accountable_type: Account::OtherAsset
accountable_id: "123e4567-e89b-12d3-a456-426614174007"
accountable_id: "123e4567-e89b-12d3-a456-426614174007"
2 changes: 1 addition & 1 deletion test/fixtures/transactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ manual_with_valuation_two:
date: <%= 10.days.ago.to_date %>
amount: -50
account: manual_with_valuation_overrides
currency: USD
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@
require "csv"

class Account::Balance::ManualAccountBalanceCalculatorTest < ActiveSupport::TestCase
# See: https://docs.google.com/spreadsheets/d/18LN5N-VLq4b49Mq1fNwF7_eBiHSQB46qQduRtdAEN98/edit?usp=sharing
setup do
@expected_balances = CSV.read("test/fixtures/account/expected_balances.csv", headers: true).map do |row|
{
"date" => (Date.current + row["date_offset"].to_i.days).to_date,
"collectable" => row["collectable"],
"checking" => row["checking"],
"savings_with_valuation_overrides" => row["savings_with_valuation_overrides"],
"credit_card" => row["credit_card"],
"multi_currency" => row["multi_currency"],

# Balances should be calculated for all currencies of an account
"eur_checking_eur" => row["eur_checking_eur"],
"eur_checking_usd" => row["eur_checking_usd"]
}
end
end

test "calculates current balance of a manual account with transactions" do
account = accounts(:manual)

Expand Down
2 changes: 1 addition & 1 deletion test/models/account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def setup
assert_equal 0, properties.children.count
assert_equal 0, vehicles.children.count
assert_equal 0, investments.children.count
assert_equal 2, other_assets.children.count
assert_equal 3, other_assets.children.count

assert_equal 1, credits.children.count
assert_equal 0, loans.children.count
Expand Down

0 comments on commit 0cbdb80

Please sign in to comment.