test/ac_account.rb in africompta-1.9.11 vs test/ac_account.rb in africompta-1.9.13.pre.10
- old
+ new
@@ -27,10 +27,12 @@
Entities.save_all
end
def test_path
assert_equal 'Root::Cash', @cash.path
+ assert_equal 0, @root.account_id
+ assert_equal nil, @root.account
end
def test_del_account
AccountRoot.accounts.each { |a|
dputs(1) { "Found root-account #{a.inspect}" }
@@ -59,16 +61,16 @@
def test_clean
Accounts.create_path('Test')
Accounts.dump true
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
- assert_equal [4, 0, 19, 1],
+ assert_equal [4, 0, 18, 1],
[count_mov, bad_mov, count_acc, bad_acc]
Accounts.dump
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
- assert_equal [4, 0, 19, 0],
+ assert_equal [4, 0, 18, 0],
[count_mov, bad_mov, count_acc, bad_acc]
end
def test_merge_two_users
@user_1.update_all
@@ -144,22 +146,22 @@
accs[src][sub] = Accounts.create("sub_#{src}_#{sub}", nil, accs[src][0])
[1, 2, 3].each { |mov|
Movements.create("Mov for #{src}_#{sub} - #{mov}", date, 100 * src,
accs[src][sub], @cash)
}
- assert_equal -300 * src, accs[src][sub].total
+ assert_equal( -300 * src, accs[src][sub].total)
}
}
reportAccount = ReportAccounts.create(account: @income, level: 1)
report = Reports.create(name: 'test', accounts: [reportAccount])
line = report.print_account_monthly(reportAccount, date, 1, 1)
dp line
end
- def test_report_man
+ def tes_report_man
SQLite.dbs_close_all
FileUtils.cp('db.man', 'data2/compta.db')
SQLite.dbs_open_load
dputs(0) { 'Finished loading' }
#Accounts.search_all_.each{|acc|dp acc.path}
@@ -170,7 +172,13 @@
reportAccount = ReportAccounts.create(account: entry, level: 1)
report = Reports.create(name: 'test', accounts: [reportAccount])
line = report.print_account_monthly(reportAccount, Date.new(2014, 6), 1, 1)
dp line
+ end
+
+ def test_add_account
+ subacc = Accounts.create_path("Root::Test")
+ Entities.reload
+ assert_equal 6, Accounts.search_all_.count
end
end