require File.dirname(__FILE__) + '/../test_helper' class ResponseTest < Test::Unit::TestCase def test_response_success assert Response.new(true, 'message', :param => 'value').success? assert !Response.new(false, 'message', :param => 'value').success? end def test_get_params response = Response.new(true, 'message', :param => 'value') assert_equal ['param'], response.params.keys end def test_avs_result response = Response.new(true, 'message', {}, :avs_result => { :code => 'A', :street_match => 'Y', :zip_match => 'N' }) avs_result = response.avs_result assert_equal 'A', avs_result['code'] assert_equal AVSResult.messages['A'], avs_result['message'] end def test_cvv_result response = Response.new(true, 'message', {}, :cvv_result => 'M') cvv_result = response.cvv_result assert_equal 'M', cvv_result['code'] assert_equal CVVResult.messages['M'], cvv_result['message'] end end