Sha256: 091636fdbd927b9b127e59f4c07d6a718281a373307c9ec01726f2099c145128

Contents?: true

Size: 1.47 KB

Versions: 17

Compression:

Stored size: 1.47 KB

Contents

require 'test_helper'

class RemoteSallieMaeTest < Test::Unit::TestCase
  def setup
    @gateway = SallieMaeGateway.new(fixtures(:sallie_mae))
    
    @amount = 100
    @credit_card = credit_card('5454545454545454')
    @declined_card = credit_card('4000300011112220')
    
    @options = { 
      :billing_address => address,
      :description => 'Store Purchase'
    }
  end

  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    assert_equal 'Accepted', response.message
  end

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

  def test_authorize_and_capture
    amount = (@amount * rand).to_i
    assert auth = @gateway.authorize(amount, @credit_card, @options)
    assert_success auth
    assert_equal 'Accepted', 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 'Missing account number', response.message
  end

  def test_invalid_login
    gateway = SallieMaeGateway.new(:login => '')
    assert response = gateway.purchase(@amount, @credit_card, @options)
    assert_failure response
    assert_equal 'Invalid merchant', response.message
  end
end

Version data entries

17 entries across 17 versions & 7 rubygems

Version Path
goldstar-activemerchant-1.4.2.7 test/remote/gateways/remote_sallie_mae_test.rb
goldstar-activemerchant-1.4.2.6 test/remote/gateways/remote_sallie_mae_test.rb
smulube-activemerchant-1.5.1.4 test/remote/gateways/remote_sallie_mae_test.rb
smulube-activemerchant-1.5.1.3 test/remote/gateways/remote_sallie_mae_test.rb
smulube-activemerchant-1.5.1.2 test/remote/gateways/remote_sallie_mae_test.rb
ghazel-activemerchant-1.4.2 test/remote/gateways/remote_sallie_mae_test.rb
activemerchant-est-1.4.2.6 test/remote/gateways/remote_sallie_mae_test.rb
activemerchant-1.5.0 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.6 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.5 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.4 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.3 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.2 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2.1 test/remote/gateways/remote_sallie_mae_test.rb
activemerchant-est-1.4.2.5 test/remote/gateways/remote_sallie_mae_test.rb
patmaddox-activemerchant-1.4.2 test/remote/gateways/remote_sallie_mae_test.rb
abtain_billing-1.0 test/remote/gateways/remote_sallie_mae_test.rb