Sha256: 16e3526ab7209306973f0f6a4c003db3b6291c5c7e2056acc388d1548b7115e4

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'

class SecurePayTechTest < Test::Unit::TestCase
  def setup
    @gateway = SecurePayTechGateway.new(
                 :login => 'x',
                 :password => 'y'
               )

    @amount = 100
    @credit_card = credit_card('4987654321098769')
    @options = {
      :billing_address => address
    }
  end
  
  def test_successful_purchase
    @gateway.expects(:ssl_post).returns(successful_purchase_response)
  
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_instance_of Response, response
    assert_success response
    assert response.test?
    assert_equal '4--120119220646821', response.authorization
  end
  
  def test_unsuccessful_purchase
    @gateway.expects(:ssl_post).returns(unsuccessful_purchase_response)
  
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_instance_of Response, response
    assert_failure response
    assert response.test?
  end
 
  private
  def successful_purchase_response
    "1,4--120119220646821,000000014511,23284,014511,20080125\r\n"
  end
  
  def unsuccessful_purchase_response
    "4,4--120119180936527,000000014510,23283,014510,20080125\r\n"
  end
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
martinstannard-activemerchant-0.1.0 test/unit/gateways/secure_pay_tech_test.rb
seamusabshere-active_merchant-1.4.2.1 test/unit/gateways/secure_pay_tech_test.rb
seamusabshere-active_merchant-1.4.2.3 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.3.1 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.4.0 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.3.0 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.4.1 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.3.2 test/unit/gateways/secure_pay_tech_test.rb
activemerchant-1.4.2 test/unit/gateways/secure_pay_tech_test.rb
merb_merchant-1.4.1 test/unit/gateways/secure_pay_tech_test.rb
spree-0.2.0 vendor/plugins/active_merchant/test/unit/gateways/secure_pay_tech_test.rb