Browse files

Customers can be created with an empty credit card hash.

  • Loading branch information...
1 parent 6c284b5 commit bab770a94fa0816263162a4d896842837992ab9d @gabebw gabebw committed Nov 18, 2011
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/fake_braintree/customer.rb
  2. +5 −0 spec/fake_braintree/customer_spec.rb
View
1 lib/fake_braintree/customer.rb
@@ -74,6 +74,7 @@ def verify_credit_card?(customer_hash)
return true if FakeBraintree.verify_all_cards
@customer_hash.key?("credit_card") &&
+ @customer_hash["credit_card"].is_a?(Hash) &&
@customer_hash["credit_card"].key?("options") &&
@customer_hash["credit_card"]["options"].is_a?(Hash) &&
@customer_hash["credit_card"]["options"]["verify_card"] == true
View
5 spec/fake_braintree/customer_spec.rb
@@ -9,6 +9,11 @@
result.should be_success
end
+ it "can handle an empty credit card hash" do
+ result = Braintree::Customer.create(:credit_card => {})
+ result.should be_success
+ end
+
it "creates a customer using an expiration month and year" do
result = Braintree::Customer.create(:credit_card => { :number => TEST_CC_NUMBER,
:expiration_month => expiration_month,

0 comments on commit bab770a

Please sign in to comment.