Sha256: 7faded3d0948d33e1fe49bd0c850b2c2d3544df9cff75866f30f79180a93f2f5

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

require 'helper'

class TestMt940Base < Test::Unit::TestCase

  should 'read the transactions with the filename of the MT940 file' do
    file_name = File.dirname(__FILE__) + '/fixtures/ing.txt'
    @transactions = MT940::Base.transactions(file_name)
    assert_equal 6, @transactions.size
  end

  should 'read the transactions with the handle to the mt940 file itself' do
    file_name = File.dirname(__FILE__) + '/fixtures/ing.txt'
    file = File.open(file_name)
    @transactions = MT940::Base.transactions(file)
    assert_equal 6, @transactions.size
  end

  should 'raise an exception if the file does not exist' do
    file_name = File.dirname(__FILE__) + '/fixtures/123.txt'
    assert_raise Errno::ENOENT do
      @transactions = MT940::Base.transactions(file_name)
    end
  end

  should 'raise an ArgumentError if a wrong argument was given' do
    assert_raise ArgumentError do
      MT940::Base.transactions(Hash.new)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mt940-0.4.0 test/test_mt940_base.rb