Sha256: 85cfe587ca1b71bb800cc7d7ad759c05b3589fe68e14da81b903d0b70a2fd050

Contents?: true

Size: 1.53 KB

Versions: 36

Compression:

Stored size: 1.53 KB

Contents

require 'test_helper'

class AVSResultTest < Test::Unit::TestCase
  def test_nil
    result = AVSResult.new(nil)
  end
  
  def test_no_match
    result = AVSResult.new(:code => 'N')
    assert_equal 'N', result.code
    assert_equal 'N', result.street_match
    assert_equal 'N', result.postal_match
    assert_equal AVSResult.messages['N'], result.message
  end
  
  def test_only_street_match
    result = AVSResult.new(:code => 'A')
    assert_equal 'A', result.code
    assert_equal 'Y', result.street_match
    assert_equal 'N', result.postal_match
    assert_equal AVSResult.messages['A'], result.message
  end
  
  def test_only_postal_match
    result = AVSResult.new(:code => 'W')
    assert_equal 'W', result.code
    assert_equal 'N', result.street_match
    assert_equal 'Y', result.postal_match
    assert_equal AVSResult.messages['W'], result.message
  end
  
  def test_nil_data
    result = AVSResult.new(:code => nil)
    assert_nil result.code
    assert_nil result.message
  end
  
  def test_empty_data
    result = AVSResult.new(:code => '')
    assert_nil result.code
    assert_nil result.message
  end
  
  def test_to_hash
    avs_data = AVSResult.new(:code => 'X').to_hash
    assert_equal 'X', avs_data['code']
    assert_equal AVSResult.messages['X'], avs_data['message']
  end
  
  def test_street_match
    avs_data = AVSResult.new(:street_match => 'Y')
    assert_equal 'Y', avs_data.street_match
  end
  
  def test_postal_match
    avs_data = AVSResult.new(:postal_match => 'Y')
    assert_equal 'Y', avs_data.postal_match
  end
end

Version data entries

36 entries across 36 versions & 11 rubygems

Version Path
johnideal-activemerchant-1.4.10 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.11 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.4 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.5 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.6 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.7 test/unit/avs_result_test.rb
johnideal-activemerchant-1.4.8 test/unit/avs_result_test.rb
mattbauer-activemerchant-1.4.2 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.3 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.4 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.5 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.6 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.7 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.8 test/unit/avs_result_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/unit/avs_result_test.rb
goldstar-activemerchant-1.4.2.7 test/unit/avs_result_test.rb
goldstar-activemerchant-1.4.2.6 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.11 test/unit/avs_result_test.rb
tomriley-active_merchant-1.4.2.10 test/unit/avs_result_test.rb
smulube-activemerchant-1.5.1.4 test/unit/avs_result_test.rb