Sha256: 004f09f265f4d40f693f6034bb7b5acebc3fe97c44a68bc84bc00677d10c43b4
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' describe FakeBraintree::SinatraApp do context "Braintree::Transaction.sale" do it "successfully creates a transaction" do result = Braintree::Transaction.sale(:payment_method_token => cc_token, :amount => 10.00) result.should be_success end context "when all cards are declined" do before { FakeBraintree.decline_all_cards! } it "fails" do result = Braintree::Transaction.sale(:payment_method_token => cc_token, :amount => 10.00) result.should_not be_success end end end end describe FakeBraintree::SinatraApp do context "Braintree::Transaction.refund" do it "successfully refunds a transaction" do result = Braintree::Transaction.refund(create_id('foobar'), '1') result.should be_success end context "when all cards are declined" do before { FakeBraintree.decline_all_cards! } it "fails" do result = Braintree::Transaction.refund(create_id('foobar'), '1') result.should_not be_success end end end end describe FakeBraintree::SinatraApp do context "Braintree::Transaction.find" do it "can find a created sale" do id = create_transaction.id result = Braintree::Transaction.find(id) result.amount.should == amount end it "can find >1 transaction" do Braintree::Transaction.find(create_transaction.id).should be Braintree::Transaction.find(create_transaction.id).should be end it "raises an error when the transaction does not exist" do expect { Braintree::Transaction.find('foobar') }.to raise_error(Braintree::NotFoundError) end def create_transaction Braintree::Transaction.sale(:payment_method_token => cc_token, :amount => amount).transaction end let(:amount) { 10.00 } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fake_braintree-0.2.1 | spec/fake_braintree/transaction_spec.rb |