From 6ccc535ad84bccae02ab6674795151015432b22d Mon Sep 17 00:00:00 2001 From: Ben Prew Date: Fri, 6 Mar 2020 22:20:34 -0800 Subject: [PATCH] Regression test for #51. --- spec/data_fixtures/51-sample.csv | 8 ++++++++ spec/data_fixtures/51-tokens.yml | 9 +++++++++ spec/reckon/app_spec.rb | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 spec/data_fixtures/51-sample.csv create mode 100644 spec/data_fixtures/51-tokens.yml diff --git a/spec/data_fixtures/51-sample.csv b/spec/data_fixtures/51-sample.csv new file mode 100644 index 0000000..43c6de1 --- /dev/null +++ b/spec/data_fixtures/51-sample.csv @@ -0,0 +1,8 @@ +01/09/2015,05354 SUBWAY,8.19,,1000.00 +02/18/2015,WENDY'S #6338,8.55,,1000.00 +02/25/2015,WENDY'S #6338,8.55,,1000.00 +02/25/2015,WENDY'S #6338,9.14,,1000.00 +02/27/2015,WENDY'S #6338,5.85,,1000.00 +03/09/2015,WENDY'S #6338,17.70,,1000.00 +03/16/2015,WENDY'S #6338,11.15,,1000.00 +03/23/2015,WENDY'S,10.12,,1000.00 diff --git a/spec/data_fixtures/51-tokens.yml b/spec/data_fixtures/51-tokens.yml new file mode 100644 index 0000000..a7f0311 --- /dev/null +++ b/spec/data_fixtures/51-tokens.yml @@ -0,0 +1,9 @@ +Expenses: + Dining: + Coffee: + - 'STARBUCKS' + - 'TIM HORTON' + Resturant: + - 'WENDY''S' + - 'SUBWAY' + - 'BARAKAT' diff --git a/spec/reckon/app_spec.rb b/spec/reckon/app_spec.rb index 8b962c5..d6a6a78 100644 --- a/spec/reckon/app_spec.rb +++ b/spec/reckon/app_spec.rb @@ -121,6 +121,22 @@ end end + context 'Issue #51 - regression test' do + it 'should assign correct accounts with tokens' do + output = StringIO.new + Reckon::App.new( + file: fixture_path('51-sample.csv'), + unattended: true, + account_tokens_file: fixture_path('51-tokens.yml'), + ignore_columns: [5], + bank_account: 'Assets:Chequing', + output_file: output + ).walk_backwards + expect(output.string).not_to include('Income:Unknown') + expect(output.string.scan('Expenses:Dining:Resturant').size).to eq(8) + end + end + #DATA BANK_CSV = (<<-CSV).strip DEBIT,20091224120000[0:GMT],"HOST 037196321563 MO 12/22SLICEHOST",-85.00