|
1 | 1 | require 'spec_helper'
|
2 | 2 |
|
3 | 3 | shared_examples 'Account API' do
|
4 |
| - it 'retrieves a stripe account', live: true do |
5 |
| - account = Stripe::Account.retrieve |
| 4 | + describe 'retrive accounts' do |
| 5 | + it 'retrieves a stripe account', live: true do |
| 6 | + account = Stripe::Account.retrieve |
6 | 7 |
|
7 |
| - expect(account).to be_a Stripe::Account |
8 |
| - expect(account.id).to match /acct\_/ |
9 |
| - end |
10 |
| - it 'retrieves a specific stripe account' do |
11 |
| - account = Stripe::Account.retrieve('acct_103ED82ePvKYlo2C') |
| 8 | + expect(account).to be_a Stripe::Account |
| 9 | + expect(account.id).to match /acct\_/ |
| 10 | + end |
| 11 | + it 'retrieves a specific stripe account' do |
| 12 | + account = Stripe::Account.retrieve('acct_103ED82ePvKYlo2C') |
12 | 13 |
|
13 |
| - expect(account).to be_a Stripe::Account |
14 |
| - expect(account.id).to match /acct\_/ |
15 |
| - end |
16 |
| - it 'retrieves all' do |
17 |
| - accounts = Stripe::Account.all |
| 14 | + expect(account).to be_a Stripe::Account |
| 15 | + expect(account.id).to match /acct\_/ |
| 16 | + end |
| 17 | + it 'retrieves all' do |
| 18 | + accounts = Stripe::Account.all |
18 | 19 |
|
19 |
| - expect(accounts).to be_a Stripe::ListObject |
20 |
| - expect(accounts.data.count).to satisfy { |n| n >= 1 } |
| 20 | + expect(accounts).to be_a Stripe::ListObject |
| 21 | + expect(accounts.data.count).to satisfy { |n| n >= 1 } |
| 22 | + end |
21 | 23 | end
|
22 |
| - it 'creates one more account' do |
23 |
| - account = Stripe::Account.create(email: 'lol@what.com') |
| 24 | + describe 'create account' do |
| 25 | + it 'creates one more account' do |
| 26 | + account = Stripe::Account.create(email: 'lol@what.com') |
| 27 | + |
| 28 | + expect(account).to be_a Stripe::Account |
| 29 | + end |
| 30 | + it 'create managed account' do |
| 31 | + account = Stripe::Account.create(managed: true, country: 'CA') |
24 | 32 |
|
25 |
| - expect(account).to be_a Stripe::Account |
| 33 | + # expect(account).to include(:keys) |
| 34 | + expect(account.keys).not_to be_nil |
| 35 | + expect(account.keys.secret).to match /sk_(live|test)_[\d\w]+/ |
| 36 | + expect(account.keys.publishable).to match /pk_(live|test)_[\d\w]+/ |
| 37 | + end |
26 | 38 | end
|
27 |
| - it 'updates account' do |
28 |
| - account = Stripe::Account.retrieve |
29 |
| - account.support_phone = '1234567' |
30 |
| - account.save |
| 39 | + describe 'updates account' do |
| 40 | + it 'updates account' do |
| 41 | + account = Stripe::Account.retrieve |
| 42 | + account.support_phone = '1234567' |
| 43 | + account.save |
31 | 44 |
|
32 |
| - account = Stripe::Account.retrieve |
| 45 | + account = Stripe::Account.retrieve |
33 | 46 |
|
34 |
| - expect(account.support_phone).to eq '1234567' |
| 47 | + expect(account.support_phone).to eq '1234567' |
| 48 | + end |
35 | 49 | end
|
36 | 50 | end
|
0 commit comments