Sha256: 74d13bc64d620655b640ee0edf61c323bb62a9e2253e822bb239fdaef2decad4
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' class Remote<%= class_name %>Test < Test::Unit::TestCase AMOUNT = 100 def setup @gateway = <%= class_name %>Gateway.new(fixtures(:<%= class_name.underscore %>)) @creditcard = credit_card('4000100011112224') @declined_card = credit_card('4000300011112220') @options = { :address => { :address1 => '1234 Shady Brook Lane', :zip => '90210' } } end def test_successful_purchase assert response = @gateway.purchase(AMOUNT, @creditcard, @options) assert_equal 'REPLACE WITH SUCCESS MESSAGE', response.message assert_success response end def test_unsuccessful_purchase assert response = @gateway.purchase(AMOUNT, @declined_card, @options) assert_equal 'REPLACE WITH FAILED PURCHASE MESSAGE', response.message assert_failure response end def test_authorize_and_capture amount = AMOUNT 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 'REPLACE WITH GATEWAY FAILURE MESSAGE', response.message end def test_invalid_login gateway = <%= class_name %>Gateway.new({ :login => '', :password => '' }) assert response = gateway.purchase(AMOUNT, @creditcard, @options) assert_equal 'REPLACE WITH FAILURE MESSAGE', response.message assert_failure response end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activemerchant-1.2.0 | script/generator/generators/gateway/templates/remote_gateway_test.rb |
activemerchant-1.2.1 | script/generator/generators/gateway/templates/remote_gateway_test.rb |