Sha256: 855b26e7322c2414edaa083078d41c372c70aadca3c1e09577614ee33565e7af

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

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

class RemoveUsaEpayTest < Test::Unit::TestCase
  def setup
    Base.gateway_mode = :test
    @gateway = UsaEpayGateway.new(fixtures(:usa_epay))
    @creditcard = credit_card('4000100011112224')
    @declined_card = credit_card('4000300011112220')
    @options = { :billing_address => address }
    @amount = 100
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options)
    assert_equal 'Success', response.message
    assert_success response
  end

  def test_unsuccessful_purchase
    assert response = @gateway.purchase(@amount, @declined_card, @options)
    assert_equal 'Card Declined', response.message
    assert_failure response
  end

  def test_authorize_and_capture
    assert auth = @gateway.authorize(@amount, @creditcard, @options)
    assert_success auth
    assert_equal 'Success', auth.message
    assert auth.authorization
    assert capture = @gateway.capture(@amount, auth.authorization)
    assert_success capture
  end

  def test_failed_capture
    assert response = @gateway.capture(@amount, '')
    assert_failure response
    assert_equal 'Unable to find original transaciton.', response.message
  end

  def test_invalid_key
    gateway = UsaEpayGateway.new(:login => '')
    assert response = gateway.purchase(@amount, @creditcard, @options)
    assert_equal 'Specified source key not found.', response.message
    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_usa_epay_test.rb
seamusabshere-active_merchant-1.4.2.1 test/remote/gateways/remote_usa_epay_test.rb
seamusabshere-active_merchant-1.4.2.3 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.3.2 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.3.0 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.3.1 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.4.1 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.4.0 test/remote/gateways/remote_usa_epay_test.rb
activemerchant-1.4.2 test/remote/gateways/remote_usa_epay_test.rb
merb_merchant-1.4.1 test/remote/gateways/remote_usa_epay_test.rb
spree-0.2.0 vendor/plugins/active_merchant/test/remote/gateways/remote_usa_epay_test.rb