stripe-ruby-mock 1.8.7.5 → 1.8.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/README.md +22 -2
- data/lib/stripe_mock/version.rb +1 -1
- data/spec/shared_stripe_examples/subscription_examples.rb +2 -1
- metadata +2 -8
data/.travis.yml
CHANGED
@@ -6,3 +6,10 @@ before_script:
|
|
6
6
|
- "sudo touch /var/log/stripe-mock-server.log"
|
7
7
|
- "sudo chown travis /var/log/stripe-mock-server.log"
|
8
8
|
script: "bundle exec rake"
|
9
|
+
notifications:
|
10
|
+
webhooks:
|
11
|
+
urls:
|
12
|
+
- https://webhooks.gitter.im/e/44a1f4718ae2efb67eac
|
13
|
+
on_success: change # options: [always|never|change] default: always
|
14
|
+
on_failure: always # options: [always|never|change] default: always
|
15
|
+
on_start: false # default: false
|
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# stripe-ruby-mock [![Build Status](https://travis-ci.org/rebelidealist/stripe-ruby-mock.png?branch=master)](https://travis-ci.org/rebelidealist/stripe-ruby-mock)
|
1
|
+
# stripe-ruby-mock [![Build Status](https://travis-ci.org/rebelidealist/stripe-ruby-mock.png?branch=master)](https://travis-ci.org/rebelidealist/stripe-ruby-mock) [![Gitter chat](https://badges.gitter.im/rebelidealist/stripe-ruby-mock.png)](https://gitter.im/rebelidealist/stripe-ruby-mock)
|
2
2
|
|
3
3
|
* Homepage: https://github.com/rebelidealist/stripe-ruby-mock
|
4
4
|
* Issues: https://github.com/rebelidealist/stripe-ruby-mock/issues
|
5
|
+
* **CHAT**: https://gitter.im/rebelidealist/stripe-ruby-mock
|
5
6
|
|
6
7
|
## Install
|
7
8
|
|
8
9
|
In your gemfile:
|
9
10
|
|
10
|
-
gem 'stripe-ruby-mock', '>= 1.8.7.
|
11
|
+
gem 'stripe-ruby-mock', '>= 1.8.7.6'
|
11
12
|
|
12
13
|
## Features
|
13
14
|
|
@@ -79,6 +80,25 @@ StripeMock.prepare_card_error(:processing_error)
|
|
79
80
|
|
80
81
|
You can see the details of each error in [lib/stripe_mock/api/errors.rb](lib/stripe_mock/api/errors.rb)
|
81
82
|
|
83
|
+
### Specifying Card Errors
|
84
|
+
|
85
|
+
By default, `prepare_card_error` only triggers for `:new_charge`, the event that happens when you run `Charge.create`. More explicitly, this is what happens by default:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
StripeMock.prepare_card_error(:card_declined, :new_charge)
|
89
|
+
```
|
90
|
+
|
91
|
+
If you want the error to trigger on a different event, you need to replace `:new_charge` with a different event. For example:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
StripeMock.prepare_card_error(:card_declined, :create_card)
|
95
|
+
customer = Stripe::Customer.create
|
96
|
+
# This line throws the card error
|
97
|
+
customer.cards.create
|
98
|
+
```
|
99
|
+
|
100
|
+
`:new_charge` and `:create_card` are names of methods in the [StripeMock request handlers](lib/stripe_mock/request_handlers). You can also set `StripeMock.debug(true)` to see the event name for each Stripe request made in your tests.
|
101
|
+
|
82
102
|
### Custom Errors
|
83
103
|
|
84
104
|
To raise an error on a specific type of request, take a look at the [request handlers folder](lib/stripe_mock/request_handlers/) and pass a method name to `StripeMock.prepare_error`.
|
data/lib/stripe_mock/version.rb
CHANGED
@@ -5,10 +5,11 @@ shared_examples 'Customer Subscriptions' do
|
|
5
5
|
it "updates a stripe customer's subscription" do
|
6
6
|
plan = Stripe::Plan.create(id: 'silver')
|
7
7
|
customer = Stripe::Customer.create(id: 'test_customer_sub', card: 'tk')
|
8
|
-
sub = customer.update_subscription({ :plan => 'silver' })
|
8
|
+
sub = customer.update_subscription({ :plan => 'silver', :quantity => 3 })
|
9
9
|
|
10
10
|
expect(sub.object).to eq('subscription')
|
11
11
|
expect(sub.plan.id).to eq('silver')
|
12
|
+
expect(sub.plan.quantity).to eq(3)
|
12
13
|
expect(sub.plan.to_hash).to eq(plan.to_hash)
|
13
14
|
|
14
15
|
customer = Stripe::Customer.retrieve('test_customer_sub')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-ruby-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.7.
|
4
|
+
version: 1.8.7.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: stripe
|
@@ -227,18 +227,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
227
|
- - ! '>='
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
|
-
segments:
|
231
|
-
- 0
|
232
|
-
hash: 93428361631981441
|
233
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
231
|
none: false
|
235
232
|
requirements:
|
236
233
|
- - ! '>='
|
237
234
|
- !ruby/object:Gem::Version
|
238
235
|
version: '0'
|
239
|
-
segments:
|
240
|
-
- 0
|
241
|
-
hash: 93428361631981441
|
242
236
|
requirements: []
|
243
237
|
rubyforge_project:
|
244
238
|
rubygems_version: 1.8.25
|