Skip to content

Commit

Permalink
reintroduces old specs
Browse files Browse the repository at this point in the history
- though they have to be adapted as they did not meet mt940 spec
  • Loading branch information
Maxim committed Jul 24, 2018
1 parent f3cee95 commit 9f60869
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
17 changes: 14 additions & 3 deletions spec/fields/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
subject(:ocmt_transaction) { Cmxl::Fields::Transaction.parse(fixture_line(:statement_ocmt)) }
subject(:ocmt_cghs_transaction) { Cmxl::Fields::Transaction.parse(fixture_line(:statement_ocmt_chgs)) }
subject(:supplementary_transaction) { Cmxl::Fields::Transaction.parse(fixture_line(:statement_supplementary_plain)) }
subject(:complex_supplementary_transaction) { Cmxl::Fields::Transaction.parse(fixture_line(:statement_supplementary_complex)) }

let(:fixture) { fixture_line(:statement_line).split(/\n/) }

Expand Down Expand Up @@ -62,8 +63,18 @@
it { expect(supplementary_transaction.charges_in_cents).to eql(nil) }
it { expect(supplementary_transaction.charges_currency).to eql(nil) }

it { expect(supplementary_transaction.reference).to eql('FOOBAR/123') }
it { expect(supplementary_transaction.bank_reference).to eql('HERP-DERP-REF') }
it { expect(supplementary_transaction.supplementary.source).to eql('random text / and stuff') }
it { expect(supplementary_transaction.supplementary.source).to eql('Card Transaction') }
end

context 'statement with complex supplementary' do
it { expect(complex_supplementary_transaction.initial_amount_in_cents).to eql(nil) }
it { expect(complex_supplementary_transaction.initial_currency).to eql(nil) }

it { expect(complex_supplementary_transaction.charges_in_cents).to eql(nil) }
it { expect(complex_supplementary_transaction.charges_currency).to eql(nil) }

it { expect(complex_supplementary_transaction.reference).to eql('FOOBAR/123') }
it { expect(complex_supplementary_transaction.bank_reference).to eql('HERP-DERP-REF') }
it { expect(complex_supplementary_transaction.supplementary.source).to eql('random text / and stuff') }
end
end
2 changes: 2 additions & 0 deletions spec/fixtures/lines/statement_supplementary_complex.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:61:180627D79,NMSCFOOBAR/123//HERP-DERP-REF
random text / and stuff
4 changes: 2 additions & 2 deletions spec/fixtures/lines/statement_supplementary_plain.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
:61:180627D79,NMSCFOOBAR/123//HERP-DERP-REF
random text / and stuff
:61:0306280628D21,00FMSCNONREF//983270000900317
Card Transaction

0 comments on commit 9f60869

Please sign in to comment.