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
smulube-activemerchant-1.5.1.3 test/unit/avs_result_test.rb
smulube-activemerchant-1.5.1.2 test/unit/avs_result_test.rb
ghazel-activemerchant-1.4.2 test/unit/avs_result_test.rb
activemerchant-est-1.4.2.6 test/unit/avs_result_test.rb
activemerchant-1.5.0 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.6 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.5 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.4 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.3 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.2 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2.1 test/unit/avs_result_test.rb
activemerchant-est-1.4.2.5 test/unit/avs_result_test.rb
patmaddox-activemerchant-1.4.2 test/unit/avs_result_test.rb
abtain_billing-1.03 test/unit/avs_result_test.rb
abtain_billing-1.02 test/unit/avs_result_test.rb
abtain_billing-1.0 test/unit/avs_result_test.rb