Sha256: 5f92566256f02bb7062a4498a3f89bfb515388470944967d25f9083719be4c7b
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
require File.dirname(__FILE__) + "/../test_helper" class TransporterTest < Test::Unit::TestCase def test_invalid_transport_type txn = ::EWS::Transaction::Request.new({ :transaction_type => :purchase, :amount => "10.13", :cardholder_name => "Simon Brown", :cc_number => "4111111111111111", :cc_expiry => "1012", :reference_no => "987987", }.merge(@@credentials.current_gateway)) tr = ::EWS::Transporter.new(@@credentials.config['location']) # should raise an exception when transport_type is not one of :json, :rest or :soap assert_raises(ArgumentError) { tr.submit(txn, :banana) } end def test_no_errors_thrown txn = ::EWS::Transaction::Request.new({ :transaction_type => :purchase, :amount => "10.13", :cardholder_name => "Simon Brown", :cc_number => "4111111111111111", :cc_expiry => "1012", :reference_no => "987987", }.merge(@@credentials.current_gateway)) assert_nothing_raised { tr = ::EWS::Transporter.new(@@credentials.config['location']) tr.submit(txn) } end def test_returns_response_object_on_server_failure req = ::EWS::Transaction::Request.new({ :transaction_type => :transaction_details }.merge(@@credentials.current_gateway)) req.transaction_tag = 9000 # non-existent txn tr = ::EWS::Transporter.new(@@credentials.config['location']) resp = tr.submit(req, :json) assert_not_nil resp assert_equal 404, resp.error_number assert_equal "Not Found", resp.error_description end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
exact4r-1.2 | ./test/general/transporter_test.rb |
exact4r-1.1 | ./test/general/transporter_test.rb |
exact4r-1.0 | ./test/general/transporter_test.rb |