Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup authorize.net tests

git-svn-id: https://activemerchant.googlecode.com/svn/trunk/active_merchant@560 6513ea26-6c20-0410-8a68-89cd7235086d
  • Loading branch information...
commit f410edc61cc5466459c2862697b5c13513254017 1 parent 2e6b704
codyfauser authored
Showing with 10 additions and 16 deletions.
  1. +1 −0  CHANGELOG
  2. +9 −16 test/unit/gateways/authorize_net_test.rb
View
1  CHANGELOG
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG
+* Fix Authorize.net test where authorize() was being called instead of purchase(). Perform some cleanup of the tests [ianlotin...@hotmail.com, cody]
* Improve Authorize.net documentation based on the DataCashGateway docs [patrick.t.joyce]
* Update EfsnetGateway to support avs and cvv data. Remove test_result_from_cc_number. [cody]
* Remove test_result_from_cc_number from DataCash. Improve unit test coverage [cody]
View
25 test/unit/gateways/authorize_net_test.rb
@@ -8,12 +8,13 @@ def setup
)
@credit_card = credit_card('4242424242424242')
+ @amount = 100
end
def test_successful_authorization
@gateway.expects(:ssl_post).returns(successful_authorization_response)
- assert response = @gateway.authorize(100, @credit_card)
+ assert response = @gateway.authorize(@amount, @credit_card)
assert_instance_of Response, response
assert_success response
assert_equal '508141794', response.authorization
@@ -22,7 +23,7 @@ def test_successful_authorization
def test_successful_purchase
@gateway.expects(:ssl_post).returns(successful_purchase_response)
- assert response = @gateway.authorize(100, @credit_card)
+ assert response = @gateway.purchase(@amount, @credit_card)
assert_instance_of Response, response
assert_success response
assert_equal '508141795', response.authorization
@@ -31,20 +32,12 @@ def test_successful_purchase
def test_failed_authorization
@gateway.expects(:ssl_post).returns(failed_authorization_response)
- assert response = @gateway.authorize(100, @credit_card)
+ assert response = @gateway.authorize(@amount, @credit_card)
assert_instance_of Response, response
assert_failure response
assert_equal '508141794', response.authorization
end
- def test_purchase_exception
- @gateway.expects(:ssl_post).raises(Error)
-
- assert_raise(Error) do
- assert response = @gateway.purchase(100, @credit_card, :order_id => 1)
- end
- end
-
def test_amount_style
assert_equal '10.34', @gateway.send(:amount, 1034)
@@ -113,7 +106,7 @@ def test_purchase_meets_minimum_requirements
def test_successful_credit
@gateway.expects(:ssl_post).returns(successful_purchase_response)
- assert response = @gateway.credit(100, '123456789', :card_number => @credit_card.number)
+ assert response = @gateway.credit(@amount, '123456789', :card_number => @credit_card.number)
assert_success response
assert_equal 'This transaction has been approved', response.message
end
@@ -121,7 +114,7 @@ def test_successful_credit
def test_failed_credit
@gateway.expects(:ssl_post).returns(failed_credit_response)
- assert response = @gateway.credit(100, '123456789', :card_number => @credit_card.number)
+ assert response = @gateway.credit(@amount, '123456789', :card_number => @credit_card.number)
assert_failure response
assert_equal 'The referenced transaction does not meet the criteria for issuing a credit', response.message
end
@@ -143,7 +136,7 @@ def test_failure_without_response_reason_text
def test_response_under_review_by_fraud_service
@gateway.expects(:ssl_post).returns(fraud_review_response)
- response = @gateway.purchase(100, @credit_card)
+ response = @gateway.purchase(@amount, @credit_card)
assert_failure response
assert response.fraud_review?
assert_equal "Thank you! For security reasons your order is currently being reviewed", response.message
@@ -152,14 +145,14 @@ def test_response_under_review_by_fraud_service
def test_avs_result
@gateway.expects(:ssl_post).returns(fraud_review_response)
- response = @gateway.purchase(100, @credit_card)
+ response = @gateway.purchase(@amount, @credit_card)
assert_equal 'X', response.avs_result['code']
end
def test_cvv_result
@gateway.expects(:ssl_post).returns(fraud_review_response)
- response = @gateway.purchase(100, @credit_card)
+ response = @gateway.purchase(@amount, @credit_card)
assert_equal 'M', response.cvv_result['code']
end
Please sign in to comment.
Something went wrong with that request. Please try again.