Skip to content

Commit

Permalink
Clean up specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Nov 16, 2011
1 parent d3097c5 commit 58a1e89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
19 changes: 7 additions & 12 deletions spec/fake_braintree/credit_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,24 @@

describe FakeBraintree::SinatraApp do
context "Braintree::CreditCard.find" do
let(:expiration_date) { "04/2016" }
let(:token) { braintree_credit_card_token(TEST_CC_NUMBER, expiration_date) }

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_year.should == "2016"
credit_card.expiration_month.should == "04"
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

context "Braintree::CreditCard.sale" do
let(:expiration_date) { "04/2016" }
let(:token) { braintree_credit_card_token(TEST_CC_NUMBER, expiration_date) }
let(:amount) { 10.00 }

it "successfully creates a sale" do
result = Braintree::CreditCard.sale(token, amount: amount, options: {submit_for_settlement: true})
result = Braintree::CreditCard.sale(cc_token, amount: 10.00)
result.should be_success

Braintree::Transaction.find(result.transaction.id).should be
lambda { Braintree::Transaction.find("foo") }.should raise_error(Braintree::NotFoundError)
end
end
end
6 changes: 2 additions & 4 deletions spec/fake_braintree/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
end

it "can find >1 transaction" do
result_one = Braintree::Transaction.find(create_transaction.id)
result_two = Braintree::Transaction.find(create_transaction.id)
result_one.should be
result_two.should be
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
Expand Down

0 comments on commit 58a1e89

Please sign in to comment.