Skip to content
This repository
Browse code

Customers can be created with an empty credit card hash.

  • Loading branch information...
commit bab770a94fa0816263162a4d896842837992ab9d 1 parent 6c284b5
Gabe Berke-Williams authored November 18, 2011
1  lib/fake_braintree/customer.rb
@@ -74,6 +74,7 @@ def verify_credit_card?(customer_hash)
74 74
       return true if FakeBraintree.verify_all_cards
75 75
 
76 76
       @customer_hash.key?("credit_card") &&
  77
+        @customer_hash["credit_card"].is_a?(Hash) &&
77 78
         @customer_hash["credit_card"].key?("options") &&
78 79
         @customer_hash["credit_card"]["options"].is_a?(Hash) &&
79 80
         @customer_hash["credit_card"]["options"]["verify_card"] == true
5  spec/fake_braintree/customer_spec.rb
@@ -9,6 +9,11 @@
9 9
     result.should be_success
10 10
   end
11 11
 
  12
+  it "can handle an empty credit card hash" do
  13
+    result = Braintree::Customer.create(:credit_card => {})
  14
+    result.should be_success
  15
+  end
  16
+
12 17
   it "creates a customer using an expiration month and year" do
13 18
     result = Braintree::Customer.create(:credit_card => { :number => TEST_CC_NUMBER,
14 19
                                                           :expiration_month => expiration_month,

0 notes on commit bab770a

Please sign in to comment.
Something went wrong with that request. Please try again.