public
Description: mudou para http://github.com/kivanio/brcobranca/tree/master
Homepage: http://github.com/kivanio/brcobranca/tree/master
Clone URL: git://github.com/kivanio/acts_as_payment.git
kivanio (author)
Wed Jan 14 06:21:21 -0800 2009
commit  549dd3b7174fe914bfa5c8ebb6a6fe491112ac73
tree    6ec3d757b92e8ea768108d8d250809b385f42fbb
parent  91ba099e355fb14b114386cbaaae4778431a701b
acts_as_payment / test / retorno_cbr643_test.rb
100644 34 lines (28 sloc) 1.28 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
 
require 'retorno/retorno_cbr643'
require 'test/unit'
 
class RetornoCbr643Test < Test::Unit::TestCase
  
  def test_should_correct_return_retorno
    @pagamentos = RetornoCbr643.new(File.join(File.dirname(__FILE__), '..', 'arquivos', 'exemplo', 'CBR64310.RET'))
    assert_equal("000002", @pagamentos.retorno.first[:sequencial])
    assert_equal("33521", @pagamentos.retorno.first[:agencia_com_dv])
    assert_equal("000141473", @pagamentos.retorno.first[:cedente_com_dv])
    assert_equal("1123725", @pagamentos.retorno.first[:convenio])
    assert_equal("080708", @pagamentos.retorno.first[:data_liquidacao])
    assert_equal("100708", @pagamentos.retorno.first[:data_credito])
    assert_equal("0000000108461", @pagamentos.retorno.first[:valor_recebido])
    assert_equal("11237250000047565", @pagamentos.retorno.first[:nosso_numero])
  end
  
  def test_should_return_excpetion_on_initialize
    assert_raise ArgumentError do
      @pagamentos = RetornoCbr643.new
      raise 'Arquivo não encontrado'
    end
  end
  
  def test_should_return_excpetion_file_not_found
    assert_raise RuntimeError do
      @pagamentos = RetornoCbr643.new("nao_existe.txt")
      raise 'Arquivo não encontrado'
    end
  end
 
end