Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 1b0ef23a6a
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (50 sloc) 1.853 kB
require 'test_helper'
class EwayTest < Test::Unit::TestCase
def setup
Base.gateway_mode = :test
@gateway = EwayGateway.new(fixtures(:eway))
@credit_card_success = credit_card('4444333322221111')
@credit_card_fail = credit_card('1234567812345678',
:month => Time.now.month,
:year => Time.now.year
)
@params = {
:order_id => '1230123',
:email => 'bob@testbob.com',
:billing_address => { :address1 => '47 Bobway',
:city => 'Bobville',
:state => 'WA',
:country => 'AU',
:zip => '2000'
} ,
:description => 'purchased items'
}
end
def test_invalid_amount
assert response = @gateway.purchase(101, @credit_card_success, @params)
assert_failure response
assert response.test?
assert_equal EwayGateway::MESSAGES["01"], response.message
end
def test_purchase_success_with_verification_value
assert response = @gateway.purchase(100, @credit_card_success, @params)
assert_equal '123456', response.authorization
assert_success response
assert response.test?
assert_equal EwayGateway::MESSAGES["00"], response.message
end
def test_purchase_success_without_verification_value
@credit_card_success.verification_value = nil
assert response = @gateway.purchase(100, @credit_card_success, @params)
assert_equal '123456', response.authorization
assert_success response
assert response.test?
assert_equal EwayGateway::MESSAGES["00"], response.message
end
def test_purchase_error
assert response = @gateway.purchase(100, @credit_card_fail, @params)
assert_nil response.authorization
assert_equal false, response.success?
assert response.test?
end
end
Jump to Line
Something went wrong with that request. Please try again.