spec/mt940_abnamro_spec.rb in zilverline-mt940-1.0 vs spec/mt940_abnamro_spec.rb in zilverline-mt940-2.0

- old
+ new

@@ -1,13 +1,13 @@ require_relative 'spec_helper' -describe "MT940::Base" do +describe MT940Structured::Parser do - context 'classis mt940' do + context 'classic mt940' do before :each do @file_name = File.dirname(__FILE__) + '/fixtures/abnamro.txt' - @bank_statements = MT940::Base.parse_mt940(@file_name)["517852257"] + @bank_statements = MT940Structured::Parser.parse_mt940(@file_name)["517852257"] @transactions = @bank_statements.flat_map(&:transactions) @transaction = @transactions.first end it 'have the correct number of transactions' do @@ -65,14 +65,15 @@ @transactions.last.contra_account.should == '528939882' end end end end + context 'sepa mt940' do before :each do @file_name = File.dirname(__FILE__) + '/fixtures/abnamro_structured.txt' - @bank_statements = MT940::Base.parse_mt940(@file_name)["123212321"] + @bank_statements = MT940Structured::Parser.parse_mt940(@file_name)["123212321"] @transactions = @bank_statements.flat_map(&:transactions) end it 'have the correct number of transactions' do @transactions.size.should == 10 @@ -86,10 +87,19 @@ it 'get the closing balance and date' do @bank_statements.last.new_balance.amount.should == 3976.9 @bank_statements.last.new_balance.date.should == Date.new(2014, 1, 27) end + context 'nonref' do + let(:transaction) { @transactions.first } + + it 'has a NONREF when contraaccount is unknown' do + transaction.contra_account.should == 'NONREF' + end + + end + context 'Transaction' do let(:transaction) { @transactions[1] } it 'have a bank_account' do @@ -129,11 +139,11 @@ it 'have an amount' do transaction.amount.should == -10 end it 'have the correct description in case of a regular bank' do - transaction.description.should == "SAVINGS 3798473" + transaction.description.should == "SAVINGS" end it 'have a date' do transaction.date.should == Date.new(2014, 1, 13) end @@ -169,11 +179,11 @@ it 'have an amount' do transaction.amount.should == -4 end it 'have the correct description in case of a regular bank' do - transaction.description.should == %Q{4851430136 0030000 735822580 NS E-TICKET(S)KENMERK: 26-01-2014 18:14 003000 0735822580} + transaction.description.should == %Q{4851430136 0030000 735822580 NS E-TICKET(S) KENMERK: 26-01-2014 18:14 003000 0735822580} end it 'have a date' do transaction.date.should == Date.new(2014, 1, 26) end @@ -238,7 +248,9 @@ it 'has a contra account owner' do transaction.contra_account_owner.should == 'BELASTINGDIENST' end end + + pending 'SEPA INCASSO ALGEMEEN DOORLOPEND' end end