Sha256: 35cb54d106aa33508a28b170c6d84a72d41591ab571dd8e8f1a9e4f834afcce3
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' describe "Braintree::CreditCard.find" do it "gets the correct credit card" do credit_card = Braintree::CreditCard.find(token) credit_card.last_4.should == TEST_CC_NUMBER[-4,4] credit_card.expiration_month.should == month credit_card.expiration_year.should == year end let(:month) { '04' } let(:year) { '2016' } let(:token) { braintree_credit_card_token(TEST_CC_NUMBER, [month, year].join('/')) } end describe "Braintree::CreditCard.create" do let(:month) { '04' } let(:year) { '2016' } let(:token) { braintree_credit_card_token(TEST_CC_NUMBER, [month, year].join('/')) } it "successfully creates card with valid data" do result = Braintree::CreditCard.create :token => token, :number => TEST_CC_NUMBER result.should be_success Braintree::CreditCard.find(token).should be end end describe "Braintree::CreditCard.sale" do it "successfully creates a sale" do result = Braintree::CreditCard.sale(cc_token, :amount => 10.00) result.should be_success Braintree::Transaction.find(result.transaction.id).should be end end describe "Braintree::CreditCard.update" do it "successfully updates the credit card" do new_expiration_date = "08/2012" token = cc_token result = Braintree::CreditCard.update(token, :expiration_date => new_expiration_date) result.should be_success Braintree::CreditCard.find(token).expiration_date.should == new_expiration_date end it "raises an error for a nonexistent credit card" do lambda { Braintree::CreditCard.update("foo", {:number => TEST_CC_NUMBER}) }.should raise_error(Braintree::NotFoundError) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fake_braintree-0.2.1 | spec/fake_braintree/credit_card_spec.rb |