Sha256: 76b59e5b2d916db3d3815ff00023150a9830d39bdc21a8e56cb776b20b638b5a

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 KB

Contents

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

class PsigateRemoteTest < Test::Unit::TestCase

  def setup
    Base.mode = :test
    @gateway = PsigateGateway.new(fixtures(:psigate))

    @amount = 2400
    @creditcard = credit_card('4242424242424242')
    @options = { 
      :order_id => generate_unique_id, 
      :billing_address => address,
      :email => 'jack@example.com' 
    }
  end
  
  def test_successful_authorization
    assert response = @gateway.authorize(@amount, @creditcard, @options)
    assert_success response
    assert_equal @options[:order_id], response.authorization
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options)
    assert_success response
    assert_equal @options[:order_id], response.authorization
  end
  
  def test_successful_authorization_and_capture
    assert authorization = @gateway.authorize(@amount, @creditcard, @options)
    assert_success authorization
    
    assert capture = @gateway.capture(@amount, authorization.authorization)
    assert_success capture
  end
  
  def test_successful_purchase_and_credit
    assert purchase = @gateway.purchase(@amount, @creditcard, @options)
    assert_success purchase
    
    assert credit = @gateway.credit(@amount, purchase.authorization)
    assert_success credit
  end
  
  def test_failed_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options.update(:test_result => 'D'))
    assert_failure response
  end
end

Version data entries

11 entries across 11 versions & 5 rubygems

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