Skip to content

Commit

Permalink
Customers can be created with an empty credit card hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Nov 18, 2011
1 parent 6c284b5 commit bab770a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/fake_braintree/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/fake_braintree/customer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bab770a

Please sign in to comment.