These are chat archives for rebelidealist/stripe-ruby-mock

21st
Apr 2016
Lemuel Barango
@lemuelbarango
Apr 21 2016 16:00
@brovikov
StripeMock.generate_bank_token(
      :bank_name => "Memory Bank",
      :last4 => "7171"
)
kathyonu
@kathyonu
Apr 21 2016 16:33

@lemuelbarango creation test:

    it 'can create a new bank account' do
    bank_account = StripeMock.generate_bank_token(
      :bank_name => "Memory Bank",
      :last4 => "7171"
    )

    verified_bank_account = Stripe.retrieve(bank_account.id)
    expect(verified_bank_account.last4).to eq '7171'
    expect(verified_bank_account.bank_name)).to eq 'Memory Bank'
  end

charge test: i am short on time, so providing a normal account charge test, which you can modify for the bank account, hope this helps, and if not, i will work on it later as this is something we will using.

 context 'Bank Charge API', live: true do
     let(:stripe_helper) { StripeMock.create_test_helper }

  it "creates a stripe charge item with a card token" do
    charge = Stripe::Charge.create({
      amount: 900,
      currency: 'usd',
      interval: 'month',
      source: stripe_helper.generate_card_token(card_number: 4242424242424242, exp_month: 9, exp_year: 2019),
      description: "Charge for user@example.com",
      }, {
        idempotency_key: "95ea4310438306ch"
    })
    expect(charge.id).to match /^test\_ch/
    expect(charge.amount).to eq 900
    expect(charge.description).to eq "Charge for user@example.com"
    expect(charge.captured).to eq true
    expect(charge.interval).to eq 'month'
  end
the first is untested, the second passes a normal charge, and should be adapted for bank account.