stripe-ruby-mock 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/stripe_mock.rb +2 -0
- data/lib/stripe_mock/api/errors.rb +2 -1
- data/lib/stripe_mock/api/instance.rb +10 -0
- data/lib/stripe_mock/api/webhooks.rb +3 -0
- data/lib/stripe_mock/data.rb +196 -17
- data/lib/stripe_mock/instance.rb +14 -3
- data/lib/stripe_mock/request_handlers/accounts.rb +7 -0
- data/lib/stripe_mock/request_handlers/charges.rb +24 -21
- data/lib/stripe_mock/request_handlers/country_spec.rb +22 -0
- data/lib/stripe_mock/request_handlers/customers.rb +3 -3
- data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +5 -2
- data/lib/stripe_mock/request_handlers/helpers/token_helpers.rb +2 -1
- data/lib/stripe_mock/request_handlers/recipients.rb +12 -0
- data/lib/stripe_mock/request_handlers/refunds.rb +88 -0
- data/lib/stripe_mock/request_handlers/subscriptions.rb +7 -6
- data/lib/stripe_mock/request_handlers/validators/param_validators.rb +5 -0
- data/lib/stripe_mock/test_strategies/base.rb +7 -4
- data/lib/stripe_mock/version.rb +1 -1
- data/lib/stripe_mock/webhook_fixtures/account.external_account.created.json +27 -0
- data/lib/stripe_mock/webhook_fixtures/account.external_account.deleted.json +27 -0
- data/lib/stripe_mock/webhook_fixtures/account.external_account.updated.json +27 -0
- data/spec/api/instance_spec.rb +30 -0
- data/spec/list_spec.rb +11 -7
- data/spec/server_spec.rb +1 -1
- data/spec/shared_stripe_examples/account_examples.rb +11 -0
- data/spec/shared_stripe_examples/card_examples.rb +13 -2
- data/spec/shared_stripe_examples/card_token_examples.rb +1 -0
- data/spec/shared_stripe_examples/charge_examples.rb +64 -15
- data/spec/shared_stripe_examples/country_specs_examples.rb +18 -0
- data/spec/shared_stripe_examples/customer_examples.rb +38 -0
- data/spec/shared_stripe_examples/error_mock_examples.rb +12 -2
- data/spec/shared_stripe_examples/plan_examples.rb +11 -0
- data/spec/shared_stripe_examples/recipient_examples.rb +7 -1
- data/spec/shared_stripe_examples/refund_examples.rb +447 -84
- data/spec/shared_stripe_examples/subscription_examples.rb +15 -0
- data/spec/support/stripe_examples.rb +1 -0
- metadata +12 -3
@@ -203,6 +203,7 @@ shared_examples 'Customer Subscriptions' do
|
|
203
203
|
expect(customer.subscriptions.data.first.id).to eq(sub.id)
|
204
204
|
expect(customer.subscriptions.data.first.plan.to_hash).to eq(plan.to_hash)
|
205
205
|
expect(customer.subscriptions.data.first.customer).to eq(customer.id)
|
206
|
+
expect(customer.charges.count).to eq(0)
|
206
207
|
end
|
207
208
|
|
208
209
|
it "subscribes a customer with no card to a free plan" do
|
@@ -360,6 +361,20 @@ shared_examples 'Customer Subscriptions' do
|
|
360
361
|
|
361
362
|
end
|
362
363
|
|
364
|
+
it 'when coupon is removed' do
|
365
|
+
plan = stripe_helper.create_plan(id: 'plan_with_coupon3', name: 'One More Test Plan', amount: 777)
|
366
|
+
customer = Stripe::Customer.create(source: gen_card_tk, plan: plan.id)
|
367
|
+
coupon = stripe_helper.create_coupon
|
368
|
+
subscription = Stripe::Subscription.retrieve(customer.subscriptions.data.first.id)
|
369
|
+
|
370
|
+
subscription.coupon = coupon.id
|
371
|
+
subscription.save
|
372
|
+
subscription.coupon = nil
|
373
|
+
subscription.save
|
374
|
+
|
375
|
+
expect(subscription.discount).to be_nil
|
376
|
+
end
|
377
|
+
|
363
378
|
it "throws an error when plan does not exist" do
|
364
379
|
free = stripe_helper.create_plan(id: 'free', amount: 0)
|
365
380
|
customer = Stripe::Customer.create(id: 'cardless', plan: 'free')
|
@@ -25,6 +25,7 @@ def it_behaves_like_stripe(&block)
|
|
25
25
|
it_behaves_like 'Stripe Error Mocking', &block
|
26
26
|
it_behaves_like 'Customer Subscriptions', &block
|
27
27
|
it_behaves_like 'Webhook Events API', &block
|
28
|
+
it_behaves_like 'Country Spec API', &block
|
28
29
|
|
29
30
|
# Integration tests
|
30
31
|
it_behaves_like 'Multiple Customer Cards'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-ruby-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gilbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stripe
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/stripe_mock/request_handlers/balance_transactions.rb
|
138
138
|
- lib/stripe_mock/request_handlers/cards.rb
|
139
139
|
- lib/stripe_mock/request_handlers/charges.rb
|
140
|
+
- lib/stripe_mock/request_handlers/country_spec.rb
|
140
141
|
- lib/stripe_mock/request_handlers/coupons.rb
|
141
142
|
- lib/stripe_mock/request_handlers/customers.rb
|
142
143
|
- lib/stripe_mock/request_handlers/disputes.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- lib/stripe_mock/request_handlers/orders.rb
|
153
154
|
- lib/stripe_mock/request_handlers/plans.rb
|
154
155
|
- lib/stripe_mock/request_handlers/recipients.rb
|
156
|
+
- lib/stripe_mock/request_handlers/refunds.rb
|
155
157
|
- lib/stripe_mock/request_handlers/sources.rb
|
156
158
|
- lib/stripe_mock/request_handlers/subscriptions.rb
|
157
159
|
- lib/stripe_mock/request_handlers/tokens.rb
|
@@ -164,6 +166,9 @@ files:
|
|
164
166
|
- lib/stripe_mock/util.rb
|
165
167
|
- lib/stripe_mock/version.rb
|
166
168
|
- lib/stripe_mock/webhook_fixtures/account.application.deauthorized.json
|
169
|
+
- lib/stripe_mock/webhook_fixtures/account.external_account.created.json
|
170
|
+
- lib/stripe_mock/webhook_fixtures/account.external_account.deleted.json
|
171
|
+
- lib/stripe_mock/webhook_fixtures/account.external_account.updated.json
|
167
172
|
- lib/stripe_mock/webhook_fixtures/account.updated.json
|
168
173
|
- lib/stripe_mock/webhook_fixtures/balance.available.json
|
169
174
|
- lib/stripe_mock/webhook_fixtures/charge.dispute.closed.json
|
@@ -203,6 +208,7 @@ files:
|
|
203
208
|
- lib/stripe_mock/webhook_fixtures/transfer.updated.json
|
204
209
|
- lib/trollop.rb
|
205
210
|
- spec/_dummy/webhooks/dummy.event.json
|
211
|
+
- spec/api/instance_spec.rb
|
206
212
|
- spec/fixtures/create_refund.yml
|
207
213
|
- spec/fixtures/stripe_webhooks/account.updated.json
|
208
214
|
- spec/fixtures/stripe_webhooks/custom.account.updated.json
|
@@ -220,6 +226,7 @@ files:
|
|
220
226
|
- spec/shared_stripe_examples/card_examples.rb
|
221
227
|
- spec/shared_stripe_examples/card_token_examples.rb
|
222
228
|
- spec/shared_stripe_examples/charge_examples.rb
|
229
|
+
- spec/shared_stripe_examples/country_specs_examples.rb
|
223
230
|
- spec/shared_stripe_examples/coupon_examples.rb
|
224
231
|
- spec/shared_stripe_examples/customer_examples.rb
|
225
232
|
- spec/shared_stripe_examples/dispute_examples.rb
|
@@ -259,12 +266,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
266
|
version: '0'
|
260
267
|
requirements: []
|
261
268
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.
|
269
|
+
rubygems_version: 2.0.14.1
|
263
270
|
signing_key:
|
264
271
|
specification_version: 4
|
265
272
|
summary: TDD with stripe
|
266
273
|
test_files:
|
267
274
|
- spec/_dummy/webhooks/dummy.event.json
|
275
|
+
- spec/api/instance_spec.rb
|
268
276
|
- spec/fixtures/create_refund.yml
|
269
277
|
- spec/fixtures/stripe_webhooks/account.updated.json
|
270
278
|
- spec/fixtures/stripe_webhooks/custom.account.updated.json
|
@@ -282,6 +290,7 @@ test_files:
|
|
282
290
|
- spec/shared_stripe_examples/card_examples.rb
|
283
291
|
- spec/shared_stripe_examples/card_token_examples.rb
|
284
292
|
- spec/shared_stripe_examples/charge_examples.rb
|
293
|
+
- spec/shared_stripe_examples/country_specs_examples.rb
|
285
294
|
- spec/shared_stripe_examples/coupon_examples.rb
|
286
295
|
- spec/shared_stripe_examples/customer_examples.rb
|
287
296
|
- spec/shared_stripe_examples/dispute_examples.rb
|