Permalink
Browse files

Can generate a transaction with no args.

  • Loading branch information...
1 parent 4fc470d commit 917a2352e8c3f25515e85e917324591dc61f92b7 Gabe Berke-Williams committed Nov 20, 2011
Showing with 7 additions and 2 deletions.
  1. +2 −1 README.md
  2. +1 −1 lib/fake_braintree.rb
  3. +4 −0 spec/fake_braintree_spec.rb
View
@@ -90,7 +90,8 @@ It takes the following options:
* `:amount`: the amount of the transaction
* `:status`: the status of the transaction, e.g. `Braintree::Transaction::Status::Failed`
-Any or all of these can be nil, and in fact are nil by default.
+Any or all of these can be nil, and in fact are nil by default. You can also
+call it with no arguments.
Full example:
View
@@ -99,7 +99,7 @@ def self.credit_card_from_token(token)
end
end
- def self.generate_transaction(options)
+ def self.generate_transaction(options = {})
history_item = { 'timestamp' => Time.now,
'amount' => options[:amount],
'status' => options[:status] }
@@ -112,6 +112,10 @@ def write_to_log
transaction['subscription_id'].should == 'foobar'
end
+ it "allows no arguments" do
+ expect { FakeBraintree.generate_transaction }.not_to raise_error
+ end
+
context "status_history" do
it "returns a hash with a status_history key" do
FakeBraintree.generate_transaction(:amount => '20').should have_key('status_history')

0 comments on commit 917a235

Please sign in to comment.