Skip to content

Commit

Permalink
Test the unhappy path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Nov 16, 2011
1 parent 638a38b commit d3097c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/fake_braintree/transaction_spec.rb
Expand Up @@ -6,6 +6,15 @@
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

Expand All @@ -24,6 +33,10 @@
result_two.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
Expand Down

0 comments on commit d3097c5

Please sign in to comment.