From 582ea83ebac0269c50e3d1a5bd465a071e2b4246 Mon Sep 17 00:00:00 2001 From: AlexMamonchik Date: Wed, 31 May 2017 04:32:45 +0600 Subject: [PATCH] added test for negative amount of transfer --- spec/shared_stripe_examples/transfer_examples.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/shared_stripe_examples/transfer_examples.rb b/spec/shared_stripe_examples/transfer_examples.rb index 85ecbc984..7754778b2 100644 --- a/spec/shared_stripe_examples/transfer_examples.rb +++ b/spec/shared_stripe_examples/transfer_examples.rb @@ -78,4 +78,20 @@ expect(e.http_status).to eq(400) } end + + it 'when amount is negative', focus: true, live: true do + rec = Stripe::Recipient.create({ + type: 'individual', + name: 'Alex Smith', + }) + expect { Stripe::Transfer.create(amount: '-400', + currency: 'usd', + recipient: rec.id, + description: 'Transfer for test@example.com') }.to raise_error { |e| + expect(e).to be_a Stripe::InvalidRequestError + expect(e.param).to eq('amount') + expect(e.message).to match(/^Invalid.*integer/) + expect(e.http_status).to eq(400) + } + end end