Permalink
Browse files

Fix style

  • Loading branch information...
1 parent bb5dc5f commit b8da8788757130df3c774a48f43f8257ebd03a2e @gabebw gabebw committed Mar 22, 2013
Showing with 26 additions and 20 deletions.
  1. +5 −5 lib/fake_braintree/sinatra_app.rb
  2. +21 −15 spec/fake_braintree/transaction_spec.rb
@@ -118,12 +118,12 @@ def hash_from_request_body_with_key(key)
if FakeBraintree.decline_all_cards?
gzipped_response(422, FakeBraintree.create_failure.to_xml(:root => 'api_error_response'))
else
- transaction = hash_from_request_body_with_key('transaction')
- transaction_id = md5("#{params[:merchant_id]}#{Time.now.to_f}")
- options = transaction["options"] || {}
- status = "authorized"
+ transaction = hash_from_request_body_with_key('transaction')
+ transaction_id = md5("#{params[:merchant_id]}#{Time.now.to_f}")
+ options = transaction["options"] || {}
+ status = "authorized"
if options.fetch("submit_for_settlement", false) == true
- status = "submitted_for_settlement"
+ status = "submitted_for_settlement"
end
transaction_response = {'id' => transaction_id, 'amount' => transaction['amount'], 'status' => status}
FakeBraintree.registry.transactions[transaction_id] = transaction_response
@@ -31,33 +31,39 @@
context "when submit_for_settlement is not true" do
it "returns a transaction with a status of authorized" do
- result = Braintree::Transaction.sale(:payment_method_token => cc_token,
- :amount => 10.00,
- :options => {
- :submit_for_settlement => false
- })
+ result = Braintree::Transaction.sale(
+ :payment_method_token => cc_token,
+ :amount => 10.00,
+ :options => {
+ :submit_for_settlement => false
+ }
+ )
result.transaction.status.should == 'authorized'
end
end
context "when submit_for_settlement does not exist" do
it "returns a transaction with a status of authorized" do
- result = Braintree::Transaction.sale(:payment_method_token => cc_token,
- :amount => 10.00,
- :options => {
- :add_billing_address_to_payment_method => true
- })
+ result = Braintree::Transaction.sale(
+ :payment_method_token => cc_token,
+ :amount => 10.00,
+ :options => {
+ :add_billing_address_to_payment_method => true
+ }
+ )
result.transaction.status.should == 'authorized'
end
end
context "when submit_for_settlement is true" do
it "returns a transaction with a status of submitted_for_settlement" do
- result = Braintree::Transaction.sale(:payment_method_token => cc_token,
- :amount => 10.00,
- :options => {
- :submit_for_settlement => true
- })
+ result = Braintree::Transaction.sale(
+ :payment_method_token => cc_token,
+ :amount => 10.00,
+ :options => {
+ :submit_for_settlement => true
+ }
+ )
result.transaction.status.should == 'submitted_for_settlement'
end
end

0 comments on commit b8da878

Please sign in to comment.