spec/unit/braintree/customer_spec.rb in braintree-2.31.0 vs spec/unit/braintree/customer_spec.rb in braintree-2.32.1

- old
+ new

@@ -26,10 +26,13 @@ output.should include(%q(fax: "483-438-5821")) output.should include(%q(first_name: "Patrick")) output.should include(%q(last_name: "Smith")) output.should include(%q(phone: "802-483-5932")) output.should include(%q(website: "patrick.smith.com")) + output.should include(%q(addresses: [])) + output.should include(%q(credit_cards: [])) + output.should include(%q(paypal_accounts: [])) output.should include(%Q(created_at: #{customer.created_at.inspect})) output.should include(%Q(updated_at: #{customer.updated_at.inspect})) end end @@ -80,10 +83,11 @@ :id, :last_name, :phone, :website, :device_data, + :payment_method_nonce, {:credit_card => [ :billing_address_id, :cardholder_name, :cvv, :device_session_id, @@ -127,10 +131,11 @@ :id, :last_name, :phone, :website, :device_data, + :payment_method_nonce, {:credit_card => [ :billing_address_id, :cardholder_name, :cvv, :device_session_id, @@ -205,16 +210,31 @@ describe "initialize" do it "converts payment method hashes into payment method objects" do customer = Braintree::Customer._new( :gateway, :credit_cards => [ - {:token => "pm1"}, - {:token => "pm2"} + {:token => "credit_card_1"}, + {:token => "credit_card_2"} + ], + :paypal_accounts => [ + {:token => "paypal_1"}, + {:token => "paypal_2"} ] ) + customer.credit_cards.size.should == 2 - customer.credit_cards[0].token.should == "pm1" - customer.credit_cards[1].token.should == "pm2" + customer.credit_cards[0].token.should == "credit_card_1" + customer.credit_cards[1].token.should == "credit_card_2" + + customer.paypal_accounts.size.should == 2 + customer.paypal_accounts[0].token.should == "paypal_1" + customer.paypal_accounts[1].token.should == "paypal_2" + + customer.payment_methods.count.should == 4 + customer.payment_methods.map(&:token).should include("credit_card_1") + customer.payment_methods.map(&:token).should include("credit_card_2") + customer.payment_methods.map(&:token).should include("paypal_1") + customer.payment_methods.map(&:token).should include("paypal_2") end end describe "new" do it "is protected" do