stripe 1.22.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class ApplicationFeeRefundTest < Test::Unit::TestCase
5
5
  should "refunds should be listable" do
6
- @mock.expects(:get).once.returns(test_response(test_application_fee))
6
+ @mock.expects(:get).once.returns(make_response(make_application_fee))
7
7
 
8
8
  application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
9
9
 
@@ -11,7 +11,7 @@ module Stripe
11
11
  end
12
12
 
13
13
  should "refunds should be refreshable" do
14
- @mock.expects(:get).twice.returns(test_response(test_application_fee), test_response(test_application_fee_refund(:id => 'refreshed_refund')))
14
+ @mock.expects(:get).twice.returns(make_response(make_application_fee), make_response(make_application_fee_refund(:id => 'refreshed_refund')))
15
15
 
16
16
  application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
17
17
  refund = application_fee.refunds.first
@@ -21,8 +21,8 @@ module Stripe
21
21
  end
22
22
 
23
23
  should "refunds should be updateable" do
24
- @mock.expects(:get).once.returns(test_response(test_application_fee))
25
- @mock.expects(:post).once.returns(test_response(test_application_fee_refund(:metadata => {'key' => 'value'})))
24
+ @mock.expects(:get).once.returns(make_response(make_application_fee))
25
+ @mock.expects(:post).once.returns(make_response(make_application_fee_refund(:metadata => {'key' => 'value'})))
26
26
 
27
27
  application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
28
28
  refund = application_fee.refunds.first
@@ -36,8 +36,8 @@ module Stripe
36
36
  end
37
37
 
38
38
  should "create should return a new refund" do
39
- @mock.expects(:get).once.returns(test_response(test_application_fee))
40
- @mock.expects(:post).once.returns(test_response(test_application_fee_refund(:id => 'test_new_refund')))
39
+ @mock.expects(:get).once.returns(make_response(make_application_fee))
40
+ @mock.expects(:post).once.returns(make_response(make_application_fee_refund(:id => 'test_new_refund')))
41
41
 
42
42
  application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
43
43
  refund = application_fee.refunds.create(:amount => 20)
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class ApplicationFeeTest < Test::Unit::TestCase
5
5
  should "application fees should be listable" do
6
- @mock.expects(:get).once.returns(test_response(test_application_fee_array))
6
+ @mock.expects(:get).once.returns(make_response(make_application_fee_array))
7
7
  fees = Stripe::ApplicationFee.all
8
8
  assert fees.data.kind_of? Array
9
9
  fees.each do |fee|
@@ -13,7 +13,7 @@ module Stripe
13
13
 
14
14
  should "application fees should be refundable" do
15
15
  @mock.expects(:get).never
16
- @mock.expects(:post).once.returns(test_response({:id => "fee_test_fee", :refunded => true}))
16
+ @mock.expects(:post).once.returns(make_response({:id => "fee_test_fee", :refunded => true}))
17
17
  fee = Stripe::ApplicationFee.new("test_application_fee")
18
18
  fee.refund
19
19
  assert fee.refunded
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class BalanceTest < Test::Unit::TestCase
5
5
  should "balance should be retrievable" do
6
- @mock.expects(:get).once.returns(test_response(test_balance))
6
+ @mock.expects(:get).once.returns(make_response(make_balance))
7
7
  balance = Stripe::Balance.retrieve
8
8
  assert_equal('balance', balance['object'])
9
9
  end
@@ -3,19 +3,19 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class BitcoinReceiverTest < Test::Unit::TestCase
5
5
  should "retrieve should retrieve bitcoin receiver" do
6
- @mock.expects(:get).once.returns(test_response(test_bitcoin_receiver))
6
+ @mock.expects(:get).once.returns(make_response(make_bitcoin_receiver))
7
7
  receiver = Stripe::BitcoinReceiver.retrieve('btcrcv_test_receiver')
8
8
  assert_equal 'btcrcv_test_receiver', receiver.id
9
9
  end
10
10
 
11
11
  should "create should create a bitcoin receiver" do
12
- @mock.expects(:post).once.returns(test_response(test_bitcoin_receiver))
12
+ @mock.expects(:post).once.returns(make_response(make_bitcoin_receiver))
13
13
  receiver = Stripe::BitcoinReceiver.create
14
14
  assert_equal "btcrcv_test_receiver", receiver.id
15
15
  end
16
16
 
17
17
  should "all should list bitcoin receivers" do
18
- @mock.expects(:get).once.returns(test_response(test_bitcoin_receiver_array))
18
+ @mock.expects(:get).once.returns(make_response(make_bitcoin_receiver_array))
19
19
  receivers = Stripe::BitcoinReceiver.all
20
20
  assert_equal 3, receivers.data.length
21
21
  assert receivers.data.kind_of? Array
@@ -28,32 +28,32 @@ module Stripe
28
28
  end
29
29
 
30
30
  should "maintain bitcoin transaction sublist" do
31
- @mock.expects(:get).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(test_response(test_bitcoin_receiver))
31
+ @mock.expects(:get).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(make_response(make_bitcoin_receiver))
32
32
  receiver = Stripe::BitcoinReceiver.retrieve('btcrcv_test_receiver')
33
- @mock.expects(:get).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver/transactions", nil, nil).once.returns(test_response(test_bitcoin_transaction_array))
33
+ @mock.expects(:get).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver/transactions", nil, nil).once.returns(make_response(make_bitcoin_transaction_array))
34
34
  transactions = receiver.transactions.all
35
35
  assert_equal(3, transactions.data.length)
36
36
  end
37
37
 
38
38
  should "update should update a bitcoin receiver" do
39
- @mock.expects(:get).once.returns(test_response(test_bitcoin_receiver))
40
- @mock.expects(:post).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, "description=details").once.returns(test_response(test_bitcoin_receiver))
41
- receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver)
39
+ @mock.expects(:get).once.returns(make_response(make_bitcoin_receiver))
40
+ @mock.expects(:post).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, "description=details").once.returns(make_response(make_bitcoin_receiver))
41
+ receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver)
42
42
  receiver.refresh
43
43
  receiver.description = "details"
44
44
  receiver.save
45
45
  end
46
46
 
47
47
  should "delete a bitcoin receiver with no customer through top-level API" do
48
- @mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"}))
49
- receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver)
48
+ @mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
49
+ receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver)
50
50
  response = receiver.delete
51
51
  assert(receiver.deleted)
52
52
  end
53
53
 
54
54
  should "delete a bitcoin receiver with a customer through customer's subresource API" do
55
- @mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"}))
56
- receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver(:customer => 'customer_foo'))
55
+ @mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
56
+ receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver(:customer => 'customer_foo'))
57
57
  response = receiver.delete
58
58
  assert(receiver.deleted)
59
59
  end
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class ChargeTest < Test::Unit::TestCase
5
5
  should "charges should be listable" do
6
- @mock.expects(:get).once.returns(test_response(test_charge_array))
6
+ @mock.expects(:get).once.returns(make_response(make_charge_array))
7
7
  c = Stripe::Charge.all
8
8
  assert c.data.kind_of? Array
9
9
  c.each do |charge|
@@ -13,7 +13,7 @@ module Stripe
13
13
 
14
14
  should "charges should be refundable" do
15
15
  @mock.expects(:get).never
16
- @mock.expects(:post).once.returns(test_response({:id => "ch_test_charge", :refunded => true}))
16
+ @mock.expects(:post).once.returns(make_response({:id => "ch_test_charge", :refunded => true}))
17
17
  c = Stripe::Charge.new("test_charge")
18
18
  c.refund
19
19
  assert c.refunded
@@ -21,15 +21,15 @@ module Stripe
21
21
 
22
22
  should "charges should not be deletable" do
23
23
  assert_raises NoMethodError do
24
- @mock.expects(:get).once.returns(test_response(test_charge))
24
+ @mock.expects(:get).once.returns(make_response(make_charge))
25
25
  c = Stripe::Charge.retrieve("test_charge")
26
26
  c.delete
27
27
  end
28
28
  end
29
29
 
30
30
  should "charges should be updateable" do
31
- @mock.expects(:get).once.returns(test_response(test_charge))
32
- @mock.expects(:post).once.returns(test_response(test_charge))
31
+ @mock.expects(:get).once.returns(make_response(make_charge))
32
+ @mock.expects(:post).once.returns(make_response(make_charge))
33
33
  c = Stripe::Charge.new("test_charge")
34
34
  c.refresh
35
35
  c.mnemonic = "New charge description"
@@ -37,23 +37,23 @@ module Stripe
37
37
  end
38
38
 
39
39
  should "charges should be able to be marked as fraudulent" do
40
- @mock.expects(:get).once.returns(test_response(test_charge))
41
- @mock.expects(:post).once.returns(test_response(test_charge))
40
+ @mock.expects(:get).once.returns(make_response(make_charge))
41
+ @mock.expects(:post).once.returns(make_response(make_charge))
42
42
  c = Stripe::Charge.new("test_charge")
43
43
  c.refresh
44
44
  c.mark_as_fraudulent
45
45
  end
46
46
 
47
47
  should "charges should be able to be marked as safe" do
48
- @mock.expects(:get).once.returns(test_response(test_charge))
49
- @mock.expects(:post).once.returns(test_response(test_charge))
48
+ @mock.expects(:get).once.returns(make_response(make_charge))
49
+ @mock.expects(:post).once.returns(make_response(make_charge))
50
50
  c = Stripe::Charge.new("test_charge")
51
51
  c.refresh
52
52
  c.mark_as_safe
53
53
  end
54
54
 
55
55
  should "charges should have Card objects associated with their Card property" do
56
- @mock.expects(:get).once.returns(test_response(test_charge))
56
+ @mock.expects(:get).once.returns(make_response(make_charge))
57
57
  c = Stripe::Charge.retrieve("test_charge")
58
58
  assert c.card.kind_of?(Stripe::StripeObject) && c.card.object == 'card'
59
59
  end
@@ -66,7 +66,7 @@ module Stripe
66
66
  'card[number]' => ['4242424242424242'],
67
67
  'card[exp_month]' => ['11']
68
68
  }
69
- end.once.returns(test_response(test_charge))
69
+ end.once.returns(make_response(make_charge))
70
70
 
71
71
  c = Stripe::Charge.create({
72
72
  :amount => 100,
@@ -86,7 +86,7 @@ module Stripe
86
86
  'currency' => ['usd'], 'amount' => ['100'],
87
87
  'source' => ['btcrcv_test_receiver']
88
88
  }
89
- end.once.returns(test_response(test_charge))
89
+ end.once.returns(make_response(make_charge))
90
90
 
91
91
  c = Stripe::Charge.create({
92
92
  :amount => 100,
@@ -3,14 +3,14 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class CouponTest < Test::Unit::TestCase
5
5
  should "create should return a new coupon" do
6
- @mock.expects(:post).once.returns(test_response(test_coupon))
6
+ @mock.expects(:post).once.returns(make_response(make_coupon))
7
7
  c = Stripe::Coupon.create
8
8
  assert_equal "co_test_coupon", c.id
9
9
  end
10
10
 
11
11
  should "coupons should be updateable" do
12
- @mock.expects(:get).once.returns(test_response(test_coupon))
13
- @mock.expects(:post).once.returns(test_response(test_coupon))
12
+ @mock.expects(:get).once.returns(make_response(make_coupon))
13
+ @mock.expects(:post).once.returns(make_response(make_coupon))
14
14
  c = Stripe::Coupon.new("test_coupon")
15
15
  c.refresh
16
16
  c.metadata['foo'] = 'bar'
@@ -5,13 +5,13 @@ module Stripe
5
5
  CUSTOMER_CARD_URL = '/v1/customers/test_customer/sources/test_card'
6
6
 
7
7
  def customer
8
- @mock.expects(:get).once.returns(test_response(test_customer))
8
+ @mock.expects(:get).once.returns(make_response(make_customer))
9
9
  Stripe::Customer.retrieve('test_customer')
10
10
  end
11
11
 
12
12
  should "customer cards should be listable" do
13
13
  c = customer
14
- @mock.expects(:get).once.returns(test_response(test_customer_card_array(customer.id)))
14
+ @mock.expects(:get).once.returns(make_response(make_customer_card_array(customer.id)))
15
15
  cards = c.sources.all(:object => "card").data
16
16
  assert cards.kind_of? Array
17
17
  assert cards[0].kind_of? Stripe::Card
@@ -19,7 +19,7 @@ module Stripe
19
19
 
20
20
  should "customer cards should have the correct url" do
21
21
  c = customer
22
- @mock.expects(:get).once.returns(test_response(test_card(
22
+ @mock.expects(:get).once.returns(make_response(make_card(
23
23
  :id => 'test_card',
24
24
  :customer => 'test_customer'
25
25
  )))
@@ -29,8 +29,8 @@ module Stripe
29
29
 
30
30
  should "customer cards should be deletable" do
31
31
  c = customer
32
- @mock.expects(:get).once.returns(test_response(test_card))
33
- @mock.expects(:delete).once.returns(test_response(test_card(:deleted => true)))
32
+ @mock.expects(:get).once.returns(make_response(make_card))
33
+ @mock.expects(:delete).once.returns(make_response(make_card(:deleted => true)))
34
34
  card = c.sources.retrieve('card')
35
35
  card.delete
36
36
  assert card.deleted
@@ -38,8 +38,8 @@ module Stripe
38
38
 
39
39
  should "customer cards should be updateable" do
40
40
  c = customer
41
- @mock.expects(:get).once.returns(test_response(test_card(:exp_year => "2000")))
42
- @mock.expects(:post).once.returns(test_response(test_card(:exp_year => "2100")))
41
+ @mock.expects(:get).once.returns(make_response(make_card(:exp_year => "2000")))
42
+ @mock.expects(:post).once.returns(make_response(make_card(:exp_year => "2100")))
43
43
  card = c.sources.retrieve('card')
44
44
  assert_equal "2000", card.exp_year
45
45
  card.exp_year = "2100"
@@ -49,7 +49,7 @@ module Stripe
49
49
 
50
50
  should "create should return a new customer card" do
51
51
  c = customer
52
- @mock.expects(:post).once.returns(test_response(test_card(:id => "test_card")))
52
+ @mock.expects(:post).once.returns(make_response(make_card(:id => "test_card")))
53
53
  card = c.sources.create(:source => "tok_41YJ05ijAaWaFS")
54
54
  assert_equal "test_card", card.id
55
55
  end
@@ -3,22 +3,22 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class CustomerTest < Test::Unit::TestCase
5
5
  should "customers should be listable" do
6
- @mock.expects(:get).once.returns(test_response(test_customer_array))
6
+ @mock.expects(:get).once.returns(make_response(make_customer_array))
7
7
  c = Stripe::Customer.all.data
8
8
  assert c.kind_of? Array
9
9
  assert c[0].kind_of? Stripe::Customer
10
10
  end
11
11
 
12
12
  should "customers should be deletable" do
13
- @mock.expects(:delete).once.returns(test_response(test_customer({:deleted => true})))
13
+ @mock.expects(:delete).once.returns(make_response(make_customer({:deleted => true})))
14
14
  c = Stripe::Customer.new("test_customer")
15
15
  c.delete
16
16
  assert c.deleted
17
17
  end
18
18
 
19
19
  should "customers should be updateable" do
20
- @mock.expects(:get).once.returns(test_response(test_customer({:mnemonic => "foo"})))
21
- @mock.expects(:post).once.returns(test_response(test_customer({:mnemonic => "bar"})))
20
+ @mock.expects(:get).once.returns(make_response(make_customer({:mnemonic => "foo"})))
21
+ @mock.expects(:post).once.returns(make_response(make_customer({:mnemonic => "bar"})))
22
22
  c = Stripe::Customer.new("test_customer").refresh
23
23
  assert_equal "foo", c.mnemonic
24
24
  c.mnemonic = "bar"
@@ -27,24 +27,24 @@ module Stripe
27
27
  end
28
28
 
29
29
  should "create should return a new customer" do
30
- @mock.expects(:post).once.returns(test_response(test_customer))
30
+ @mock.expects(:post).once.returns(make_response(make_customer))
31
31
  c = Stripe::Customer.create
32
32
  assert_equal "c_test_customer", c.id
33
33
  end
34
34
 
35
35
  should "create_upcoming_invoice should create a new invoice" do
36
- @mock.expects(:post).once.returns(test_response(test_invoice))
36
+ @mock.expects(:post).once.returns(make_response(make_invoice))
37
37
  i = Stripe::Customer.new("test_customer").create_upcoming_invoice
38
38
  assert_equal "c_test_customer", i.customer
39
39
  end
40
40
 
41
41
  should "be able to update a customer's subscription" do
42
- @mock.expects(:get).once.returns(test_response(test_customer))
42
+ @mock.expects(:get).once.returns(make_response(make_customer))
43
43
  c = Stripe::Customer.retrieve("test_customer")
44
44
 
45
45
  @mock.expects(:post).once.with do |url, api_key, params|
46
46
  url == "#{Stripe.api_base}/v1/customers/c_test_customer/subscription" && api_key.nil? && CGI.parse(params) == {'plan' => ['silver']}
47
- end.returns(test_response(test_subscription(:plan => 'silver')))
47
+ end.returns(make_response(make_subscription(:plan => 'silver')))
48
48
  s = c.update_subscription({:plan => 'silver'})
49
49
 
50
50
  assert_equal 'subscription', s.object
@@ -52,15 +52,15 @@ module Stripe
52
52
  end
53
53
 
54
54
  should "be able to cancel a customer's subscription" do
55
- @mock.expects(:get).once.returns(test_response(test_customer))
55
+ @mock.expects(:get).once.returns(make_response(make_customer))
56
56
  c = Stripe::Customer.retrieve("test_customer")
57
57
 
58
58
  # Not an accurate response, but whatever
59
59
 
60
- @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscription?at_period_end=true", nil, nil).returns(test_response(test_subscription(:plan => 'silver')))
60
+ @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscription?at_period_end=true", nil, nil).returns(make_response(make_subscription(:plan => 'silver')))
61
61
  c.cancel_subscription({:at_period_end => 'true'})
62
62
 
63
- @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscription", nil, nil).returns(test_response(test_subscription(:plan => 'silver')))
63
+ @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscription", nil, nil).returns(make_response(make_subscription(:plan => 'silver')))
64
64
  c.cancel_subscription
65
65
  end
66
66
 
@@ -69,7 +69,7 @@ module Stripe
69
69
 
70
70
  @mock.expects(:post).once.with do |url, api_key, params|
71
71
  url == "#{Stripe.api_base}/v1/customers/test_customer/subscriptions" && api_key.nil? && CGI.parse(params) == {'plan' => ['silver']}
72
- end.returns(test_response(test_subscription(:plan => 'silver')))
72
+ end.returns(make_response(make_subscription(:plan => 'silver')))
73
73
  s = c.create_subscription({:plan => 'silver'})
74
74
 
75
75
  assert_equal 'subscription', s.object
@@ -77,10 +77,10 @@ module Stripe
77
77
  end
78
78
 
79
79
  should "be able to delete a customer's discount" do
80
- @mock.expects(:get).once.returns(test_response(test_customer))
80
+ @mock.expects(:get).once.returns(make_response(make_customer))
81
81
  c = Stripe::Customer.retrieve("test_customer")
82
82
 
83
- @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/discount", nil, nil).returns(test_response(test_delete_discount_response))
83
+ @mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/discount", nil, nil).returns(make_response(make_delete_discount_response))
84
84
  c.delete_discount
85
85
  assert_equal nil, c.discount
86
86
  end
@@ -3,7 +3,7 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class FileUploadTest < Test::Unit::TestCase
5
5
  should "create should return a new file" do
6
- @mock.expects(:post).once.returns(test_response(test_file))
6
+ @mock.expects(:post).once.returns(make_response(make_file))
7
7
  f = Stripe::FileUpload.create({
8
8
  :purpose => "dispute_evidence",
9
9
  :file => File.new(__FILE__),
@@ -12,14 +12,14 @@ module Stripe
12
12
  end
13
13
 
14
14
  should "files should be retrievable" do
15
- @mock.expects(:get).once.returns(test_response(test_file))
15
+ @mock.expects(:get).once.returns(make_response(make_file))
16
16
  c = Stripe::FileUpload.new("fil_test_file")
17
17
  c.refresh
18
18
  assert_equal 1403047735, c.created
19
19
  end
20
20
 
21
21
  should "files should be listable" do
22
- @mock.expects(:get).once.returns(test_response(test_file_array))
22
+ @mock.expects(:get).once.returns(make_response(make_file_array))
23
23
  c = Stripe::FileUpload.all.data
24
24
  assert c.kind_of? Array
25
25
  assert c[0].kind_of? Stripe::FileUpload
@@ -3,35 +3,35 @@ require File.expand_path('../../test_helper', __FILE__)
3
3
  module Stripe
4
4
  class InvoiceTest < Test::Unit::TestCase
5
5
  should "retrieve should retrieve invoices" do
6
- @mock.expects(:get).once.returns(test_response(test_invoice))
6
+ @mock.expects(:get).once.returns(make_response(make_invoice))
7
7
  i = Stripe::Invoice.retrieve('in_test_invoice')
8
8
  assert_equal 'in_test_invoice', i.id
9
9
  end
10
10
 
11
11
  should "create should create a new invoice" do
12
- @mock.expects(:post).once.returns(test_response(test_invoice))
12
+ @mock.expects(:post).once.returns(make_response(make_invoice))
13
13
  i = Stripe::Invoice.create
14
14
  assert_equal "in_test_invoice", i.id
15
15
  end
16
16
 
17
17
  should "pay should pay an invoice" do
18
- @mock.expects(:get).once.returns(test_response(test_invoice))
18
+ @mock.expects(:get).once.returns(make_response(make_invoice))
19
19
  i = Stripe::Invoice.retrieve('in_test_invoice')
20
20
 
21
- @mock.expects(:post).once.with('https://api.stripe.com/v1/invoices/in_test_invoice/pay', nil, '').returns(test_response(test_paid_invoice))
21
+ @mock.expects(:post).once.with('https://api.stripe.com/v1/invoices/in_test_invoice/pay', nil, '').returns(make_response(make_paid_invoice))
22
22
  i.pay
23
23
  assert_equal nil, i.next_payment_attempt
24
24
  end
25
25
 
26
26
  should "pay with extra opts should pay an invoice" do
27
- @mock.expects(:get).once.returns(test_response(test_invoice))
27
+ @mock.expects(:get).once.returns(make_response(make_invoice))
28
28
  i = Stripe::Invoice.retrieve('in_test_invoice', {:api_key => 'foobar'})
29
29
 
30
30
  Stripe.expects(:execute_request).with do |opts|
31
31
  opts[:url] == "#{Stripe.api_base}/v1/invoices/in_test_invoice/pay" &&
32
32
  opts[:method] == :post &&
33
33
  opts[:headers][:authorization] == 'Bearer foobar'
34
- end.returns(test_response(test_paid_invoice))
34
+ end.returns(make_response(make_paid_invoice))
35
35
 
36
36
  i.pay
37
37
  assert_equal nil, i.next_payment_attempt