reckon 0.6.2 ā 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +54 -3
- data/Gemfile.lock +1 -1
- data/README.md +23 -19
- data/Rakefile +2 -2
- data/bin/build-new-version.sh +26 -0
- data/bin/reckon +4 -1
- data/lib/reckon.rb +1 -0
- data/lib/reckon/app.rb +13 -150
- data/lib/reckon/cosine_similarity.rb +67 -62
- data/lib/reckon/date_column.rb +3 -2
- data/lib/reckon/ledger_parser.rb +1 -1
- data/lib/reckon/money.rb +12 -5
- data/lib/reckon/options.rb +157 -0
- data/lib/reckon/version.rb +1 -1
- data/spec/cosine_training_and_test.rb +52 -0
- data/spec/integration/another_bank_example/output.ledger +3 -3
- data/spec/integration/ask_for_account/cli_input.exp +33 -0
- data/spec/integration/ask_for_account/expected_output +11 -0
- data/spec/integration/ask_for_account/input.csv +9 -0
- data/spec/integration/ask_for_account/test_args +1 -0
- data/spec/integration/broker_canada_example/output.ledger +2 -2
- data/spec/integration/chase/account_tokens_and_regex/output.ledger +3 -3
- data/spec/integration/chase/default_account_names/output.ledger +3 -3
- data/spec/integration/chase/learn_from_existing/output.ledger +3 -3
- data/spec/integration/chase/simple/output.ledger +3 -3
- data/spec/integration/danish_kroner_nordea_example/output.ledger +1 -1
- data/spec/integration/extratofake/output.ledger +1 -1
- data/spec/integration/harder_date_example/output.ledger +2 -2
- data/spec/integration/invalid_header_example/test_args +1 -1
- data/spec/integration/ledger_date_format/compare_cmds +1 -0
- data/spec/integration/ledger_date_format/input.csv +3 -0
- data/spec/integration/ledger_date_format/output.ledger +12 -0
- data/spec/integration/ledger_date_format/test_args +1 -0
- data/spec/integration/test.sh +78 -27
- data/spec/reckon/app_spec.rb +21 -19
- data/spec/reckon/csv_parser_spec.rb +3 -3
- data/spec/reckon/date_column_spec.rb +12 -0
- data/spec/reckon/money_spec.rb +3 -3
- data/spec/reckon/options_spec.rb +17 -0
- data/spec/spec_helper.rb +6 -1
- metadata +15 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
2003-12-24 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $2,105.00
|
3
3
|
Income:Unknown
|
4
4
|
|
5
5
|
2004-12-24 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
|
@@ -15,11 +15,11 @@
|
|
15
15
|
Expenses:Unknown
|
16
16
|
|
17
17
|
2007-12-24 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
|
18
|
-
Assets:Bank:Checking $
|
18
|
+
Assets:Bank:Checking $1,558.52
|
19
19
|
Income:Unknown
|
20
20
|
|
21
21
|
2008-12-24 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $3,520.00
|
23
23
|
Income:Unknown
|
24
24
|
|
25
25
|
2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/expect -f
|
2
|
+
|
3
|
+
|
4
|
+
set timeout 7
|
5
|
+
match_max 100000
|
6
|
+
expect "What is this account named in Ledger |Assets:Bank:Checking|?\r
|
7
|
+
\[1Gā½\[6n"
|
8
|
+
send -- "\[45;2R"
|
9
|
+
expect -exact "\[1G\[K\[6n"
|
10
|
+
send -- "\[45;1R"
|
11
|
+
expect "\[1G\[K\[1G\[1G"
|
12
|
+
send -- "T"
|
13
|
+
expect "\[1GT\[K\[1G\[2G"
|
14
|
+
send -- "e"
|
15
|
+
expect "\[1GTe\[K\[1G\[3G"
|
16
|
+
send -- "s"
|
17
|
+
expect "\[1GTes\[K\[1G\[4G"
|
18
|
+
send -- "t"
|
19
|
+
expect "\[1GTest\[K\[1G\[5G"
|
20
|
+
send -- ":"
|
21
|
+
expect "\[1GTest:\[K\[1G\[6G"
|
22
|
+
send -- ":"
|
23
|
+
expect "\[1GTest::\[K\[1G\[7G"
|
24
|
+
send -- "B"
|
25
|
+
expect "\[1GTest::B\[K\[1G\[8G"
|
26
|
+
send -- "a"
|
27
|
+
expect "\[1GTest::Ba\[K\[1G\[9G"
|
28
|
+
send -- "n"
|
29
|
+
expect "\[1GTest::Ban\[K\[1G\[10G"
|
30
|
+
send -- "k"
|
31
|
+
expect "\[1GTest::Bank\[K\[1G\[11G"
|
32
|
+
send -- "\r"
|
33
|
+
expect eof
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
Date | Amount | Description | Note |
|
3
|
+
2003-12-24 | $2,105.00 | CREDIT; Some Company vendorpymt PPD ID: 5KL3832735 | |
|
4
|
+
2004-12-24 | -$116.22 | CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL | |
|
5
|
+
2005-12-24 | -$0.96 | DEBIT; WEBSITE-BALANCE-10DEC09 12 12/10WEBSITE-BAL | |
|
6
|
+
2006-12-24 | $0.23 | DEBIT; WEBSITE-BALANCE-17DEC09 12 12/17WEBSITE-BAL | |
|
7
|
+
2007-12-24 | $1,558.52 | CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563 | |
|
8
|
+
2008-12-24 | $3,520.00 | CREDIT; Some Company vendorpymt PPD ID: 59728JSL20 | |
|
9
|
+
2009-12-24 | -$7.00 | DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04 | |
|
10
|
+
2010-12-24 | -$20.00 | CHECK; CHECK 2656 | |
|
11
|
+
2011-12-24 | -$85.00 | DEBIT; HOST 037196321563 MO 12/22SLICEHOST | |
|
@@ -0,0 +1,9 @@
|
|
1
|
+
DEBIT,2011/12/24,"HOST 037196321563 MO 12/22SLICEHOST",($85.00)
|
2
|
+
CHECK,2010/12/24,"CHECK 2656",($20.00)
|
3
|
+
DEBIT,2009/12/24,"GITHUB 041287430274 CA 12/22GITHUB 04",($7.00)
|
4
|
+
CREDIT,2008/12/24,"Some Company vendorpymt PPD ID: 59728JSL20",$3520.00
|
5
|
+
CREDIT,2007/12/24,"Blarg BLARG REVENUE PPD ID: 00jah78563",$1558.52
|
6
|
+
DEBIT,2006/12/24,"WEBSITE-BALANCE-17DEC09 12 12/17WEBSITE-BAL",$.23
|
7
|
+
DEBIT,2005/12/24,"WEBSITE-BALANCE-10DEC09 12 12/10WEBSITE-BAL",($0.96)
|
8
|
+
CREDIT,2004/12/24,"PAYPAL TRANSFER PPD ID: PAYPALSDSL",($116.22)
|
9
|
+
CREDIT,2003/12/24,"Some Company vendorpymt PPD ID: 5KL3832735",$2105.00
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv -p
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
2013-06-19 2013-06-24; Buy; ISHARES S&P/TSX CAPPED REIT IN; XRE; 300; 15.90; CDN; CAD
|
10
10
|
Income:Unknown
|
11
|
-
Assets:Bank:Checking -$
|
11
|
+
Assets:Bank:Checking -$4,779.95
|
12
12
|
|
13
13
|
2013-06-27 2013-06-27; Dividend; ICICI BK SPONSORED ADR; IBN; 100; USD
|
14
14
|
Assets:Bank:Checking $66.70
|
@@ -19,7 +19,7 @@
|
|
19
19
|
Income:Unknown
|
20
20
|
|
21
21
|
2014-01-07 2014-01-10; Sell; BMO NASDAQ 100 EQTY HEDGED TO; ZQQ; -300; 27.44; CDN; CAD
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $8,222.05
|
23
23
|
Income:Unknown
|
24
24
|
|
25
25
|
2014-01-07 2014-01-07; Interest; BMO S&P/TSX EQUAL WEIGHT BKS I; ZEB; 250; CAD
|
@@ -1,5 +1,5 @@
|
|
1
1
|
2009-12-10 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $2,105.00
|
3
3
|
Income:Unknown
|
4
4
|
|
5
5
|
2009-12-11 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
|
@@ -15,11 +15,11 @@
|
|
15
15
|
Assets:Bank:Checking -$12.23
|
16
16
|
|
17
17
|
2009-12-23 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
|
18
|
-
Assets:Bank:Checking $
|
18
|
+
Assets:Bank:Checking $3,520.00
|
19
19
|
Income:Unknown
|
20
20
|
|
21
21
|
2009-12-23 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $1,558.52
|
23
23
|
Income:Unknown
|
24
24
|
|
25
25
|
2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
|
@@ -1,5 +1,5 @@
|
|
1
1
|
2009-12-10 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $2,105.00
|
3
3
|
Income:Default
|
4
4
|
|
5
5
|
2009-12-11 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
|
@@ -15,11 +15,11 @@
|
|
15
15
|
Assets:Bank:Checking -$12.23
|
16
16
|
|
17
17
|
2009-12-23 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
|
18
|
-
Assets:Bank:Checking $
|
18
|
+
Assets:Bank:Checking $3,520.00
|
19
19
|
Income:Default
|
20
20
|
|
21
21
|
2009-12-23 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $1,558.52
|
23
23
|
Income:Default
|
24
24
|
|
25
25
|
2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
|
@@ -1,5 +1,5 @@
|
|
1
1
|
2009-12-10 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $2,105.00
|
3
3
|
Income:Unknown
|
4
4
|
|
5
5
|
2009-12-11 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
|
@@ -15,11 +15,11 @@
|
|
15
15
|
Assets:Bank:Checking -$12.23
|
16
16
|
|
17
17
|
2009-12-23 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
|
18
|
-
Assets:Bank:Checking $
|
18
|
+
Assets:Bank:Checking $3,520.00
|
19
19
|
Income:Unknown
|
20
20
|
|
21
21
|
2009-12-23 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $1,558.52
|
23
23
|
Income:Unknown
|
24
24
|
|
25
25
|
2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
|
@@ -1,5 +1,5 @@
|
|
1
1
|
2009-12-10 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $2,105.00
|
3
3
|
Income:Unknown
|
4
4
|
|
5
5
|
2009-12-11 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
|
@@ -15,11 +15,11 @@
|
|
15
15
|
Assets:Bank:Checking -$12.23
|
16
16
|
|
17
17
|
2009-12-23 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
|
18
|
-
Assets:Bank:Checking $
|
18
|
+
Assets:Bank:Checking $3,520.00
|
19
19
|
Income:Unknown
|
20
20
|
|
21
21
|
2009-12-23 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
|
22
|
-
Assets:Bank:Checking $
|
22
|
+
Assets:Bank:Checking $1,558.52
|
23
23
|
Income:Unknown
|
24
24
|
|
25
25
|
2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
|
@@ -1,5 +1,5 @@
|
|
1
1
|
2009-11-04 TRANSFER CREDIT INTERNET TRANSFER; INTERNET TRANSFER; 1234.00
|
2
|
-
Assets:Bank:Checking $
|
2
|
+
Assets:Bank:Checking $1,234.00
|
3
3
|
Income:Unknown
|
4
4
|
|
5
5
|
2009-11-10 TRANSFER DEBIT INTERNET TRANSFER; INTERNET TRANSFER MORTGAGE; 0.00
|
@@ -16,5 +16,5 @@
|
|
16
16
|
|
17
17
|
2011-11-04 TRANSFER DEBIT INTERNET TRANSFER; INTERNET TRANSFER SAV TO MECU; 0.00
|
18
18
|
Income:Unknown
|
19
|
-
Assets:Bank:Checking -$
|
19
|
+
Assets:Bank:Checking -$1,234.00
|
20
20
|
|
@@ -1 +1 @@
|
|
1
|
-
-f input.csv --unattended --account Assets:Bank:Checking --contains-header
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --contains-header 4
|
@@ -0,0 +1 @@
|
|
1
|
+
ledger --input-date-format '%d/%m/%Y'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
02/12/2009 BLARG R SH 456930; $1,826.06
|
2
|
+
Assets:Bank:Checking $327.49
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
02/12/2009 Check - 0000000122; 122; $1,750.06
|
6
|
+
Income:Unknown
|
7
|
+
Assets:Bank:Checking -$76.00
|
8
|
+
|
9
|
+
02/12/2009 Check - 0000000112; 112; $1,498.57
|
10
|
+
Income:Unknown
|
11
|
+
Assets:Bank:Checking -$800.00
|
12
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --date-format '%d/%m/%Y' --ledger-date-format '%d/%m/%Y'
|
data/spec/integration/test.sh
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# set -x
|
4
|
-
|
5
3
|
set -Euo pipefail
|
6
4
|
|
5
|
+
|
7
6
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
8
7
|
TEST_DIFF=""
|
9
8
|
OUTPUT=""
|
10
|
-
RECKON_CMD="
|
9
|
+
RECKON_CMD="reckon -v"
|
10
|
+
export RUBYLIB=$SCRIPT_DIR/../../lib:${RUBYLIB:-}
|
11
|
+
export PATH="$SCRIPT_DIR/../../bin:$PATH"
|
11
12
|
|
12
13
|
main () {
|
13
14
|
trap test_fail EXIT
|
@@ -20,28 +21,64 @@ main () {
|
|
20
21
|
|
21
22
|
echo > test.log
|
22
23
|
|
24
|
+
NUM_TESTS=$(echo "$TESTS" |wc -l |awk '{print $1}')
|
25
|
+
|
26
|
+
echo "1..$NUM_TESTS"
|
27
|
+
|
28
|
+
I=1
|
29
|
+
|
23
30
|
for t in $TESTS; do
|
24
|
-
OUTPUT_FILE=$(mktemp)
|
25
31
|
TEST_DIR=$(dirname "$t")
|
32
|
+
TEST_LOG=$(mktemp)
|
26
33
|
pushd "$TEST_DIR" >/dev/null || exit 1
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
compare_output "$OUTPUT_FILE"
|
34
|
+
if [[ -e "cli_input.exp" ]]; then
|
35
|
+
cli_test >$TEST_LOG 2>&1
|
36
|
+
else
|
37
|
+
unattended_test >$TEST_LOG 2>&1
|
38
|
+
fi
|
33
39
|
|
34
40
|
popd >/dev/null || exit 1
|
35
41
|
# have to save output after popd
|
36
42
|
echo -e "\n\n======>$TEST_DIR" >> test.log
|
37
|
-
echo -e "TEST_CMD
|
43
|
+
echo -e "TEST_CMD: $TEST_CMD" >> test.log
|
44
|
+
cat $TEST_LOG >> test.log
|
38
45
|
|
39
46
|
if [[ $ERROR -ne 0 ]]; then
|
47
|
+
echo -e "not ok $I - $TEST_DIR"
|
48
|
+
tail -n25 test.log
|
40
49
|
exit 1
|
50
|
+
else
|
51
|
+
echo -e "ok $I - $TEST_DIR"
|
41
52
|
fi
|
53
|
+
I=$(($I + 1))
|
42
54
|
done
|
43
55
|
}
|
44
56
|
|
57
|
+
cli_test () {
|
58
|
+
OUTPUT_FILE=$(mktemp)
|
59
|
+
CLI_CMD="$RECKON_CMD --table-output-file $OUTPUT_FILE $(cat test_args)"
|
60
|
+
TEST_CMD="expect -d -c 'spawn $CLI_CMD' cli_input.exp"
|
61
|
+
eval $TEST_CMD 2>&1
|
62
|
+
ERROR=0
|
63
|
+
TEST_DIFF=$(diff -u "$OUTPUT_FILE" expected_output)
|
64
|
+
|
65
|
+
# ${#} is character length, test that there was no output from diff
|
66
|
+
if [ ${#TEST_DIFF} -eq 0 ]; then
|
67
|
+
ERROR=0
|
68
|
+
else
|
69
|
+
ERROR=1
|
70
|
+
fi
|
71
|
+
}
|
72
|
+
|
73
|
+
unattended_test() {
|
74
|
+
OUTPUT_FILE=$(mktemp)
|
75
|
+
TEST_CMD="$RECKON_CMD -o $OUTPUT_FILE $(cat test_args)"
|
76
|
+
eval $TEST_CMD 2>&1
|
77
|
+
ERROR=0
|
78
|
+
|
79
|
+
compare_output "$OUTPUT_FILE"
|
80
|
+
}
|
81
|
+
|
45
82
|
test_fail () {
|
46
83
|
STATUS=$?
|
47
84
|
if [[ $STATUS -ne 0 ]]; then
|
@@ -50,11 +87,40 @@ test_fail () {
|
|
50
87
|
fi
|
51
88
|
}
|
52
89
|
|
90
|
+
compare_output () {
|
91
|
+
OUTPUT_FILE=$1
|
92
|
+
pwd
|
93
|
+
if [[ -e compare_cmds ]]; then
|
94
|
+
COMPARE_CMDS=$(cat compare_cmds)
|
95
|
+
else
|
96
|
+
COMPARE_CMDS=$'ledger\nhledger'
|
97
|
+
fi
|
98
|
+
|
99
|
+
ERROR=1
|
100
|
+
while IFS= read -r n; do
|
101
|
+
if compare_output_for "$OUTPUT_FILE" "$n"; then
|
102
|
+
ERROR=0
|
103
|
+
else
|
104
|
+
ERROR=1
|
105
|
+
break
|
106
|
+
fi
|
107
|
+
done <<< "$COMPARE_CMDS"
|
108
|
+
}
|
109
|
+
|
53
110
|
compare_output_for () {
|
54
111
|
OUTPUT_FILE=$1
|
55
112
|
LEDGER=$2
|
56
113
|
|
57
|
-
|
114
|
+
EXPECTED_FILE=$(mktemp)
|
115
|
+
ACTUAL_FILE=$(mktemp)
|
116
|
+
|
117
|
+
echo $LEDGER -f output.ledger r "$EXPECTED_FILE"
|
118
|
+
eval $LEDGER -f output.ledger r >"$EXPECTED_FILE" || return 1
|
119
|
+
|
120
|
+
echo $LEDGER -f output.ledger r "$ACTUAL_FILE"
|
121
|
+
eval $LEDGER -f output.ledger r >"$ACTUAL_FILE" || return 1
|
122
|
+
|
123
|
+
TEST_DIFF=$(diff -u "$EXPECTED_FILE" "$ACTUAL_FILE")
|
58
124
|
|
59
125
|
# ${#} is character length, test that there was no output from diff
|
60
126
|
if [ ${#TEST_DIFF} -eq 0 ]; then
|
@@ -64,19 +130,4 @@ compare_output_for () {
|
|
64
130
|
fi
|
65
131
|
}
|
66
132
|
|
67
|
-
compare_output () {
|
68
|
-
OUTPUT_FILE=$1
|
69
|
-
|
70
|
-
for n in {ledger,hledger}; do
|
71
|
-
echo -n " - $n..."
|
72
|
-
if compare_output_for "$OUTPUT_FILE" "$n"; then
|
73
|
-
echo "SUCCESS!"
|
74
|
-
else
|
75
|
-
echo "FAILED!"
|
76
|
-
ERROR=1
|
77
|
-
return 0
|
78
|
-
fi
|
79
|
-
done
|
80
|
-
}
|
81
|
-
|
82
133
|
main "$@"
|
data/spec/reckon/app_spec.rb
CHANGED
@@ -16,10 +16,10 @@ describe Reckon::App do
|
|
16
16
|
describe "each_row_backwards" do
|
17
17
|
it "should return rows with hashes" do
|
18
18
|
@rows[0][:pretty_date].should == "2009-12-10"
|
19
|
-
@rows[0][:pretty_money].should == " $
|
19
|
+
@rows[0][:pretty_money].should == " $2,105.00"
|
20
20
|
@rows[0][:description].should == "CREDIT; Some Company vendorpymt PPD ID: 5KL3832735"
|
21
21
|
@rows[1][:pretty_date].should == "2009-12-11"
|
22
|
-
@rows[1][:pretty_money].should == "
|
22
|
+
@rows[1][:pretty_money].should == " $116.22"
|
23
23
|
@rows[1][:description].should == "CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL"
|
24
24
|
end
|
25
25
|
end
|
@@ -37,14 +37,16 @@ describe Reckon::App do
|
|
37
37
|
|
38
38
|
context 'unattended mode with chase csv input' do
|
39
39
|
let(:output_file) { StringIO.new }
|
40
|
-
let(:chase)
|
40
|
+
let(:chase) do
|
41
41
|
Reckon::App.new(
|
42
42
|
string: BANK_CSV,
|
43
43
|
unattended: true,
|
44
44
|
output_file: output_file,
|
45
|
-
bank_account: 'Assets:Bank:Checking'
|
45
|
+
bank_account: 'Assets:Bank:Checking',
|
46
|
+
default_into_account: 'Expenses:Unknown',
|
47
|
+
default_outof_account: 'Income:Unknown',
|
46
48
|
)
|
47
|
-
|
49
|
+
end
|
48
50
|
|
49
51
|
describe 'walk backwards' do
|
50
52
|
it 'should assign Income:Unknown and Expenses:Unknown by default' do
|
@@ -87,20 +89,20 @@ describe Reckon::App do
|
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
it 'should fail-on-unknown-account' do
|
93
|
+
chase = Reckon::App.new(
|
94
|
+
string: BANK_CSV,
|
95
|
+
unattended: true,
|
96
|
+
output_file: output_file,
|
97
|
+
bank_account: 'Assets:Bank:Checking',
|
98
|
+
default_into_account: 'Expenses:Unknown',
|
99
|
+
default_outof_account: 'Income:Unknown',
|
100
|
+
fail_on_unknown_account: true
|
101
|
+
)
|
98
102
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
)
|
103
|
-
end
|
103
|
+
expect { chase.walk_backwards }.to(
|
104
|
+
raise_error(RuntimeError, /Couldn't find any matches/)
|
105
|
+
)
|
104
106
|
end
|
105
107
|
end
|
106
108
|
|
@@ -162,7 +164,7 @@ describe Reckon::App do
|
|
162
164
|
CREDIT,20091223120000[0:GMT],"Blarg BLARG REVENUE PPD ID: 00jah78563",1558.52
|
163
165
|
DEBIT,20091221120000[0:GMT],"WEBSITE-BALANCE-17DEC09 12 12/17WEBSITE-BAL",-12.23
|
164
166
|
DEBIT,20091214120000[0:GMT],"WEBSITE-BALANCE-10DEC09 12 12/10WEBSITE-BAL",-20.96
|
165
|
-
CREDIT,20091211120000[0:GMT],"PAYPAL TRANSFER PPD ID: PAYPALSDSL"
|
167
|
+
CREDIT,20091211120000[0:GMT],"PAYPAL TRANSFER PPD ID: PAYPALSDSL",116.22
|
166
168
|
CREDIT,20091210120000[0:GMT],"Some Company vendorpymt PPD ID: 5KL3832735",2105.00
|
167
169
|
CSV
|
168
170
|
|