stripe-ruby-mock 3.0.1 → 3.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -5
- data/CHANGELOG.md +28 -15
- data/Gemfile +1 -0
- data/lib/stripe_mock.rb +4 -0
- data/lib/stripe_mock/api/client.rb +1 -1
- data/lib/stripe_mock/api/instance.rb +1 -1
- data/lib/stripe_mock/api/webhooks.rb +2 -0
- data/lib/stripe_mock/client.rb +2 -1
- data/lib/stripe_mock/data.rb +127 -25
- data/lib/stripe_mock/data/list.rb +31 -6
- data/lib/stripe_mock/instance.rb +7 -2
- data/lib/stripe_mock/request_handlers/account_links.rb +15 -0
- data/lib/stripe_mock/request_handlers/charges.rb +6 -4
- data/lib/stripe_mock/request_handlers/checkout_session.rb +16 -0
- data/lib/stripe_mock/request_handlers/customers.rb +22 -13
- data/lib/stripe_mock/request_handlers/ephemeral_key.rb +1 -1
- data/lib/stripe_mock/request_handlers/express_login_links.rb +15 -0
- data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +12 -7
- data/lib/stripe_mock/request_handlers/invoices.rb +4 -3
- data/lib/stripe_mock/request_handlers/payment_methods.rb +8 -5
- data/lib/stripe_mock/request_handlers/prices.rb +44 -0
- data/lib/stripe_mock/request_handlers/sources.rb +12 -6
- data/lib/stripe_mock/request_handlers/subscriptions.rb +29 -19
- data/lib/stripe_mock/request_handlers/tokens.rb +6 -4
- data/lib/stripe_mock/request_handlers/validators/param_validators.rb +32 -0
- data/lib/stripe_mock/test_strategies/base.rb +26 -0
- data/lib/stripe_mock/version.rb +1 -1
- data/lib/stripe_mock/webhook_fixtures/balance.available.json +6 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json +186 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json +164 -0
- data/spec/instance_spec.rb +4 -6
- data/spec/list_spec.rb +23 -0
- data/spec/server_spec.rb +4 -2
- data/spec/shared_stripe_examples/account_link_examples.rb +16 -0
- data/spec/shared_stripe_examples/balance_examples.rb +6 -0
- data/spec/shared_stripe_examples/card_token_examples.rb +17 -21
- data/spec/shared_stripe_examples/checkout_examples.rb +20 -1
- data/spec/shared_stripe_examples/customer_examples.rb +11 -13
- data/spec/shared_stripe_examples/express_login_link_examples.rb +12 -0
- data/spec/shared_stripe_examples/invoice_examples.rb +8 -8
- data/spec/shared_stripe_examples/payment_method_examples.rb +332 -68
- data/spec/shared_stripe_examples/price_examples.rb +183 -0
- data/spec/shared_stripe_examples/subscription_examples.rb +115 -8
- data/spec/spec_helper.rb +4 -0
- data/spec/stripe_mock_spec.rb +2 -2
- data/spec/support/stripe_examples.rb +5 -1
- data/stripe-ruby-mock.gemspec +6 -1
- metadata +25 -11
@@ -0,0 +1,183 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples 'Price API' do
|
4
|
+
let(:product) { stripe_helper.create_product }
|
5
|
+
let(:product_id) { product.id }
|
6
|
+
|
7
|
+
let(:price_attributes) { {
|
8
|
+
:id => "price_abc123",
|
9
|
+
:product => product_id,
|
10
|
+
:nickname => "My Mock price",
|
11
|
+
:amount => 9900,
|
12
|
+
:currency => "usd",
|
13
|
+
:interval => "month"
|
14
|
+
} }
|
15
|
+
let(:price) { Stripe::Price.create(price_attributes) }
|
16
|
+
|
17
|
+
let(:price_attributes_without_id){ price_attributes.merge(id: nil) }
|
18
|
+
let(:price_without_id){ Stripe::Price.create(price_attributes_without_id) }
|
19
|
+
|
20
|
+
let(:price_attributes_with_trial) { price_attributes.merge(id: "prod_TRIAL", :trial_period_days => 30) }
|
21
|
+
let(:price_with_trial) { Stripe::Price.create(price_attributes_with_trial) }
|
22
|
+
|
23
|
+
let(:metadata) { {:description => "desc text", :info => "info text"} }
|
24
|
+
let(:price_attributes_with_metadata) { price_attributes.merge(id: "prod_META", metadata: metadata) }
|
25
|
+
let(:price_with_metadata) { Stripe::Price.create(price_attributes_with_metadata) }
|
26
|
+
|
27
|
+
before(:each) do
|
28
|
+
product
|
29
|
+
end
|
30
|
+
|
31
|
+
it "creates a stripe price" do
|
32
|
+
expect(price.id).to eq('price_abc123')
|
33
|
+
expect(price.nickname).to eq('My Mock price')
|
34
|
+
expect(price.amount).to eq(9900)
|
35
|
+
|
36
|
+
expect(price.currency).to eq('usd')
|
37
|
+
expect(price.interval).to eq("month")
|
38
|
+
|
39
|
+
expect(price_with_metadata.metadata.description).to eq('desc text')
|
40
|
+
expect(price_with_metadata.metadata.info).to eq('info text')
|
41
|
+
|
42
|
+
expect(price_with_trial.trial_period_days).to eq(30)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "creates a stripe price without specifying ID" do
|
46
|
+
expect(price_attributes_without_id[:id]).to be_nil
|
47
|
+
expect(price_without_id.id).to match(/^test_price_1/)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "stores a created stripe price in memory" do
|
51
|
+
price
|
52
|
+
price2 = Stripe::Price.create(price_attributes.merge(id: "price_def456", amount: 299))
|
53
|
+
|
54
|
+
data = test_data_source(:prices)
|
55
|
+
expect(data[price.id]).to_not be_nil
|
56
|
+
expect(data[price.id][:amount]).to eq(9900)
|
57
|
+
expect(data[price2.id]).to_not be_nil
|
58
|
+
expect(data[price2.id][:amount]).to eq(299)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "retrieves a stripe price" do
|
62
|
+
original = stripe_helper.create_price(product: product_id, amount: 1331, id: 'price_943843')
|
63
|
+
price = Stripe::Price.retrieve(original.id)
|
64
|
+
|
65
|
+
expect(price.id).to eq(original.id)
|
66
|
+
expect(price.amount).to eq(original.amount)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "updates a stripe price" do
|
70
|
+
stripe_helper.create_price(id: 'super_member', product: product_id, amount: 111)
|
71
|
+
|
72
|
+
price = Stripe::Price.retrieve('super_member')
|
73
|
+
expect(price.amount).to eq(111)
|
74
|
+
|
75
|
+
price.amount = 789
|
76
|
+
price.save
|
77
|
+
price = Stripe::Price.retrieve('super_member')
|
78
|
+
expect(price.amount).to eq(789)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "cannot retrieve a stripe price that doesn't exist" do
|
82
|
+
expect { Stripe::Price.retrieve('nope') }.to raise_error {|e|
|
83
|
+
expect(e).to be_a Stripe::InvalidRequestError
|
84
|
+
expect(e.param).to eq('price')
|
85
|
+
expect(e.http_status).to eq(404)
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
it "retrieves all prices" do
|
90
|
+
stripe_helper.create_price(id: 'price One', product: product_id, amount: 54321)
|
91
|
+
stripe_helper.create_price(id: 'price Two', product: product_id, amount: 98765)
|
92
|
+
|
93
|
+
all = Stripe::Price.list
|
94
|
+
expect(all.count).to eq(2)
|
95
|
+
expect(all.map &:id).to include('price One', 'price Two')
|
96
|
+
expect(all.map &:amount).to include(54321, 98765)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'retrieves prices with limit' do
|
100
|
+
101.times do | i|
|
101
|
+
stripe_helper.create_price(id: "price #{i}", product: product_id, amount: 11)
|
102
|
+
end
|
103
|
+
all = Stripe::Price.list(limit: 100)
|
104
|
+
|
105
|
+
expect(all.count).to eq(100)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "retrieves prices with lookup keys" do
|
109
|
+
stripe_helper.create_price(id: 'price One', product: product_id, amount: 54321, lookup_key: 'one')
|
110
|
+
stripe_helper.create_price(id: 'price Two', product: product_id, amount: 98765, lookup_key: 'two')
|
111
|
+
|
112
|
+
all = Stripe::Price.list({lookup_keys: ['one', 'two']})
|
113
|
+
expect(all.count).to eq(2)
|
114
|
+
expect(all.map &:id).to include('price One', 'price Two')
|
115
|
+
expect(all.map &:amount).to include(54321, 98765)
|
116
|
+
|
117
|
+
one = Stripe::Price.list({lookup_keys: ['one']})
|
118
|
+
expect(one.count).to eq(1)
|
119
|
+
expect(one.map &:id).to include('price One')
|
120
|
+
expect(one.map &:amount).to include(54321)
|
121
|
+
|
122
|
+
two = Stripe::Price.list({lookup_keys: ['two']})
|
123
|
+
expect(two.count).to eq(1)
|
124
|
+
expect(two.map &:id).to include('price Two')
|
125
|
+
expect(two.map &:amount).to include(98765)
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "Validations", :live => true do
|
129
|
+
include_context "stripe validator"
|
130
|
+
let(:params) { stripe_helper.create_price_params(product: product_id) }
|
131
|
+
let(:subject) { Stripe::Price.create(params) }
|
132
|
+
|
133
|
+
describe "Associations" do
|
134
|
+
let(:not_found_product_id){ "prod_NONEXIST" }
|
135
|
+
let(:not_found_message) { stripe_validator.not_found_message(Stripe::Product, not_found_product_id) }
|
136
|
+
let(:params) { stripe_helper.create_price_params(product: not_found_product_id) }
|
137
|
+
let(:products) { stripe_helper.list_products(100).data }
|
138
|
+
|
139
|
+
it "validates associated product" do
|
140
|
+
expect(products.map(&:id)).to_not include(not_found_product_id)
|
141
|
+
expect { subject }.to raise_error(Stripe::InvalidRequestError, not_found_message)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "Presence" do
|
146
|
+
after do
|
147
|
+
params.delete(@name)
|
148
|
+
message = "Missing required param: #{@name}."
|
149
|
+
expect { subject }.to raise_error(Stripe::InvalidRequestError, message)
|
150
|
+
end
|
151
|
+
|
152
|
+
it("validates presence of currency") { @name = :currency }
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe "Mock Data" do
|
157
|
+
let(:mock_object) { StripeMock::Data.mock_price }
|
158
|
+
let(:known_attributes) { [
|
159
|
+
:id,
|
160
|
+
:object,
|
161
|
+
:active,
|
162
|
+
:billing_scheme,
|
163
|
+
:created,
|
164
|
+
:currency,
|
165
|
+
:livemode,
|
166
|
+
:lookup_key,
|
167
|
+
:metadata,
|
168
|
+
:nickname,
|
169
|
+
:product,
|
170
|
+
:recurring,
|
171
|
+
:tiers_mode,
|
172
|
+
:transform_quantity,
|
173
|
+
:type,
|
174
|
+
:unit_amount,
|
175
|
+
:unit_amount_decimal
|
176
|
+
] }
|
177
|
+
|
178
|
+
it "includes all retreived attributes" do
|
179
|
+
expect(mock_object.keys).to eql(known_attributes)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'securerandom'
|
3
3
|
|
4
|
-
shared_examples 'Customer Subscriptions' do
|
4
|
+
shared_examples 'Customer Subscriptions with plans' do
|
5
5
|
let(:gen_card_tk) { stripe_helper.generate_card_token }
|
6
6
|
|
7
7
|
let(:product) { stripe_helper.create_product }
|
@@ -14,7 +14,7 @@ shared_examples 'Customer Subscriptions' do
|
|
14
14
|
let(:free_plan) { stripe_helper.create_plan(id: 'free', product: product.id, amount: 0) }
|
15
15
|
|
16
16
|
context "creating a new subscription" do
|
17
|
-
it "adds a new subscription to customer with none using items", :
|
17
|
+
it "adds a new subscription to customer with none using items", live: true do
|
18
18
|
plan
|
19
19
|
customer = Stripe::Customer.create(source: gen_card_tk)
|
20
20
|
|
@@ -49,7 +49,7 @@ shared_examples 'Customer Subscriptions' do
|
|
49
49
|
expect(subscriptions.data.first.metadata.example).to eq( "yes" )
|
50
50
|
end
|
51
51
|
|
52
|
-
it "adds a new subscription to customer with none", :
|
52
|
+
it "adds a new subscription to customer with none", live: true do
|
53
53
|
plan
|
54
54
|
customer = Stripe::Customer.create(source: gen_card_tk)
|
55
55
|
subscriptions = Stripe::Subscription.list(customer: customer.id)
|
@@ -117,6 +117,33 @@ shared_examples 'Customer Subscriptions' do
|
|
117
117
|
expect(subscriptions.data.first.metadata.example).to eq( "yes" )
|
118
118
|
end
|
119
119
|
|
120
|
+
it "adds a new subscription with payment method provided as default" do
|
121
|
+
plan
|
122
|
+
customer = Stripe::Customer.create(source: gen_card_tk)
|
123
|
+
payment_method = Stripe::PaymentMethod.create(
|
124
|
+
type: 'card',
|
125
|
+
card: {
|
126
|
+
number: 4242_4242_4242_4242,
|
127
|
+
exp_month: 9,
|
128
|
+
exp_year: (Time.now.year + 5),
|
129
|
+
cvc: 999
|
130
|
+
}
|
131
|
+
)
|
132
|
+
sub = Stripe::Subscription.create(
|
133
|
+
plan: 'silver',
|
134
|
+
customer: customer,
|
135
|
+
metadata: { foo: "bar", example: "yes" },
|
136
|
+
collection_method: 'send_invoice',
|
137
|
+
default_payment_method: payment_method.id,
|
138
|
+
)
|
139
|
+
|
140
|
+
subscriptions = Stripe::Subscription.list(customer: customer.id)
|
141
|
+
expect(subscriptions.count).to eq(1)
|
142
|
+
expect(subscriptions.data.first.id).to eq(sub.id)
|
143
|
+
expect(subscriptions.data.first.collection_method).to eq('send_invoice')
|
144
|
+
expect(subscriptions.data.first.default_payment_method).to eq(payment_method.id)
|
145
|
+
end
|
146
|
+
|
120
147
|
it "adds a new subscription to customer (string/symbol agnostic)" do
|
121
148
|
customer = Stripe::Customer.create(source: gen_card_tk)
|
122
149
|
subscriptions = Stripe::Subscription.list(customer: customer.id)
|
@@ -550,7 +577,7 @@ shared_examples 'Customer Subscriptions' do
|
|
550
577
|
expect(sub1).to eq(sub2)
|
551
578
|
end
|
552
579
|
|
553
|
-
it "adds a new subscription to customer with different idempotency key", :
|
580
|
+
it "adds a new subscription to customer with different idempotency key", live: true do
|
554
581
|
product = stripe_helper.create_product(name: 'Silver Product')
|
555
582
|
plan = stripe_helper.create_plan(id: 'silver', product: product.id,
|
556
583
|
amount: 4999, currency: 'usd')
|
@@ -754,6 +781,43 @@ shared_examples 'Customer Subscriptions' do
|
|
754
781
|
expect(subscription.pending_invoice_item_interval.interval_count).to eq 3
|
755
782
|
end
|
756
783
|
|
784
|
+
it "updates a subscription's default payment method" do
|
785
|
+
plan
|
786
|
+
customer = Stripe::Customer.create(source: gen_card_tk)
|
787
|
+
payment_method_card = Stripe::PaymentMethod.create(
|
788
|
+
type: 'card',
|
789
|
+
card: {
|
790
|
+
number: 4242_4242_4242_4242,
|
791
|
+
exp_month: 9,
|
792
|
+
exp_year: (Time.now.year + 5),
|
793
|
+
cvc: 999
|
794
|
+
}
|
795
|
+
)
|
796
|
+
payment_method_sepa = Stripe::PaymentMethod.create(
|
797
|
+
type: 'sepa_debit',
|
798
|
+
sepa_debit: {iban: 'DE89370400440532013000'},
|
799
|
+
)
|
800
|
+
subscription = Stripe::Subscription.create(
|
801
|
+
plan: 'silver',
|
802
|
+
customer: customer,
|
803
|
+
metadata: { foo: "bar", example: "yes" },
|
804
|
+
default_payment_method: payment_method_card.id,
|
805
|
+
)
|
806
|
+
|
807
|
+
subscriptions = Stripe::Subscription.list(customer: customer)
|
808
|
+
expect(subscriptions.data.first.default_payment_method).to eq(payment_method_card.id)
|
809
|
+
|
810
|
+
Stripe::Subscription.update(
|
811
|
+
subscription.id,
|
812
|
+
default_payment_method: payment_method_sepa.id,
|
813
|
+
collection_method: 'send_invoice',
|
814
|
+
)
|
815
|
+
|
816
|
+
subscriptions = Stripe::Subscription.list(customer: customer)
|
817
|
+
expect(subscriptions.data.first.collection_method).to eq('send_invoice')
|
818
|
+
expect(subscriptions.data.first.default_payment_method).to eq(payment_method_sepa.id)
|
819
|
+
end
|
820
|
+
|
757
821
|
it 'when adds coupon', live: true do
|
758
822
|
coupon = stripe_helper.create_coupon
|
759
823
|
customer = Stripe::Customer.create(source: gen_card_tk, plan: plan.id)
|
@@ -971,7 +1035,7 @@ shared_examples 'Customer Subscriptions' do
|
|
971
1035
|
context "cancelling a subscription" do
|
972
1036
|
let(:customer) { Stripe::Customer.create(id: 'test_customer_sub', source: gen_card_tk, plan: plan.id) }
|
973
1037
|
|
974
|
-
it "cancels a stripe customer's subscription", :
|
1038
|
+
it "cancels a stripe customer's subscription", live: true do
|
975
1039
|
customer = Stripe::Customer.create(source: gen_card_tk, plan: plan.id)
|
976
1040
|
|
977
1041
|
sub = Stripe::Subscription.retrieve(customer.subscriptions.data.first.id)
|
@@ -1051,7 +1115,7 @@ shared_examples 'Customer Subscriptions' do
|
|
1051
1115
|
expect(customer.subscriptions.data.first.status).to eq('trialing')
|
1052
1116
|
end
|
1053
1117
|
|
1054
|
-
it "doesn't require a card when trial_end is present", :
|
1118
|
+
it "doesn't require a card when trial_end is present", live: true do
|
1055
1119
|
plan = stripe_helper.create_plan(
|
1056
1120
|
:amount => 2000,
|
1057
1121
|
:product => product.id,
|
@@ -1083,7 +1147,7 @@ shared_examples 'Customer Subscriptions' do
|
|
1083
1147
|
expect(subscription.items.object).to eq('list')
|
1084
1148
|
expect(subscription.items.data.class).to eq(Array)
|
1085
1149
|
expect(subscription.items.data.count).to eq(1)
|
1086
|
-
expect(subscription.items.data.first.id).to
|
1150
|
+
expect(subscription.items.data.first.id).to include('test_si_')
|
1087
1151
|
expect(subscription.items.data.first.created).to eq(1504716183)
|
1088
1152
|
expect(subscription.items.data.first.object).to eq('subscription_item')
|
1089
1153
|
expect(subscription.items.data.first.plan.amount).to eq(0)
|
@@ -1122,7 +1186,7 @@ shared_examples 'Customer Subscriptions' do
|
|
1122
1186
|
|
1123
1187
|
describe "metadata" do
|
1124
1188
|
|
1125
|
-
it "creates a stripe customer and subscribes them to a plan with meta data", :
|
1189
|
+
it "creates a stripe customer and subscribes them to a plan with meta data", live: true do
|
1126
1190
|
|
1127
1191
|
stripe_helper.
|
1128
1192
|
create_plan(
|
@@ -1151,3 +1215,46 @@ shared_examples 'Customer Subscriptions' do
|
|
1151
1215
|
end
|
1152
1216
|
|
1153
1217
|
end
|
1218
|
+
|
1219
|
+
shared_examples 'Customer Subscriptions with prices' do
|
1220
|
+
let(:gen_card_tk) { stripe_helper.generate_card_token }
|
1221
|
+
|
1222
|
+
let(:product) { stripe_helper.create_product }
|
1223
|
+
let(:price) { stripe_helper.create_price(product: product.id, amount: 4999, currency: 'usd') }
|
1224
|
+
|
1225
|
+
context "creating a new subscription" do
|
1226
|
+
it "adds a new subscription to customer with none using items", live: true do
|
1227
|
+
customer = Stripe::Customer.create(source: gen_card_tk)
|
1228
|
+
|
1229
|
+
expect(customer.subscriptions.data).to be_empty
|
1230
|
+
expect(customer.subscriptions.count).to eq(0)
|
1231
|
+
|
1232
|
+
subscription = Stripe::Subscription.create({
|
1233
|
+
customer: customer.id,
|
1234
|
+
items: [{ price: price.id }],
|
1235
|
+
metadata: { foo: "bar", example: "yes" }
|
1236
|
+
})
|
1237
|
+
|
1238
|
+
expect(subscription.object).to eq('subscription')
|
1239
|
+
expect(subscription.plan.to_hash).to eq(price.to_hash)
|
1240
|
+
expect(subscription.metadata.foo).to eq("bar")
|
1241
|
+
expect(subscription.metadata.example).to eq("yes")
|
1242
|
+
|
1243
|
+
customer = Stripe::Customer.retrieve(customer.id)
|
1244
|
+
subscriptions = Stripe::Subscription.list(customer: customer.id)
|
1245
|
+
charges = Stripe::Charge.list(customer: customer.id)
|
1246
|
+
|
1247
|
+
expect(subscriptions.data).to_not be_empty
|
1248
|
+
expect(subscriptions.count).to eq(1)
|
1249
|
+
expect(subscriptions.data.length).to eq(1)
|
1250
|
+
expect(charges.data.length).to eq(1)
|
1251
|
+
expect(customer.currency).to eq("usd")
|
1252
|
+
|
1253
|
+
expect(subscriptions.data.first.id).to eq(subscription.id)
|
1254
|
+
expect(subscriptions.data.first.plan.to_hash).to eq(price.to_hash)
|
1255
|
+
expect(subscriptions.data.first.customer).to eq(customer.id)
|
1256
|
+
expect(subscriptions.data.first.metadata.foo).to eq( "bar" )
|
1257
|
+
expect(subscriptions.data.first.metadata.example).to eq( "yes" )
|
1258
|
+
end
|
1259
|
+
end
|
1260
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,9 @@ require 'rspec'
|
|
5
5
|
require 'stripe'
|
6
6
|
require 'stripe_mock'
|
7
7
|
require 'stripe_mock/server'
|
8
|
+
require 'dotenv'
|
9
|
+
|
10
|
+
Dotenv.load('.env')
|
8
11
|
|
9
12
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
13
|
# in spec/support/ and its subdirectories.
|
@@ -33,6 +36,7 @@ RSpec.configure do |c|
|
|
33
36
|
when '2.4.6' then ENV['STRIPE_TEST_SECRET_KEY_A']
|
34
37
|
when '2.5.5' then ENV['STRIPE_TEST_SECRET_KEY_B']
|
35
38
|
when '2.6.3' then ENV['STRIPE_TEST_SECRET_KEY_C']
|
39
|
+
when '2.7.0' then ENV['STRIPE_TEST_SECRET_KEY_D']
|
36
40
|
end
|
37
41
|
else
|
38
42
|
api_key = ENV['STRIPE_TEST_SECRET_KEY']
|
data/spec/stripe_mock_spec.rb
CHANGED
@@ -35,8 +35,8 @@ describe StripeMock do
|
|
35
35
|
StripeMock.stop
|
36
36
|
StripeMock.start
|
37
37
|
|
38
|
-
expect(StripeMock.instance.customers[:x]).to be_nil
|
39
|
-
expect(StripeMock.instance.customers.keys.length).to eq(0)
|
38
|
+
expect(StripeMock.instance.customers[''][:x]).to be_nil
|
39
|
+
expect(StripeMock.instance.customers[''].keys.length).to eq(0)
|
40
40
|
StripeMock.stop
|
41
41
|
end
|
42
42
|
|
@@ -5,6 +5,7 @@ end
|
|
5
5
|
|
6
6
|
def it_behaves_like_stripe(&block)
|
7
7
|
it_behaves_like 'Account API', &block
|
8
|
+
it_behaves_like 'Account Link API', &block
|
8
9
|
it_behaves_like 'Balance API', &block
|
9
10
|
it_behaves_like 'Balance Transaction API', &block
|
10
11
|
it_behaves_like 'Bank Account Token Mocking', &block
|
@@ -12,6 +13,7 @@ def it_behaves_like_stripe(&block)
|
|
12
13
|
it_behaves_like 'Card API', &block
|
13
14
|
it_behaves_like 'Charge API', &block
|
14
15
|
it_behaves_like 'Bank API', &block
|
16
|
+
it_behaves_like 'Express Login Link API', &block
|
15
17
|
it_behaves_like 'External Account API', &block
|
16
18
|
it_behaves_like 'Coupon API', &block
|
17
19
|
it_behaves_like 'Customer API', &block
|
@@ -20,6 +22,7 @@ def it_behaves_like_stripe(&block)
|
|
20
22
|
it_behaves_like 'Invoice API', &block
|
21
23
|
it_behaves_like 'Invoice Item API', &block
|
22
24
|
it_behaves_like 'Plan API', &block
|
25
|
+
it_behaves_like 'Price API', &block
|
23
26
|
it_behaves_like 'Product API', &block
|
24
27
|
it_behaves_like 'Recipient API', &block
|
25
28
|
it_behaves_like 'Refund API', &block
|
@@ -29,7 +32,8 @@ def it_behaves_like_stripe(&block)
|
|
29
32
|
it_behaves_like 'PaymentMethod API', &block
|
30
33
|
it_behaves_like 'SetupIntent API', &block
|
31
34
|
it_behaves_like 'Stripe Error Mocking', &block
|
32
|
-
it_behaves_like 'Customer Subscriptions', &block
|
35
|
+
it_behaves_like 'Customer Subscriptions with plans', &block
|
36
|
+
it_behaves_like 'Customer Subscriptions with prices', &block
|
33
37
|
it_behaves_like 'Subscription Items API', &block
|
34
38
|
it_behaves_like 'Webhook Events API', &block
|
35
39
|
it_behaves_like 'Country Spec API', &block
|
data/stripe-ruby-mock.gemspec
CHANGED
@@ -10,7 +10,12 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.license = "MIT"
|
11
11
|
gem.authors = ["Gilbert"]
|
12
12
|
gem.email = "gilbertbgarza@gmail.com"
|
13
|
-
gem.homepage = "https://github.com/
|
13
|
+
gem.homepage = "https://github.com/stripe-ruby-mock/stripe-ruby-mock"
|
14
|
+
gem.metadata = {
|
15
|
+
"bug_tracker_uri" => "https://github.com/stripe-ruby-mock/stripe-ruby-mock/issues",
|
16
|
+
"changelog_uri" => "https://github.com/stripe-ruby-mock/stripe-ruby-mock/blob/master/CHANGELOG.md",
|
17
|
+
"source_code_uri" => "https://github.com/stripe-ruby-mock/stripe-ruby-mock"
|
18
|
+
}
|
14
19
|
|
15
20
|
gem.files = `git ls-files`.split($/)
|
16
21
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|