stripe-rails 1.1.0 → 1.1.1
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/.travis.yml +24 -23
- data/Changelog.md +4 -0
- data/Gemfile +3 -1
- data/README.md +5 -3
- data/lib/stripe/rails/testing.rb +19 -0
- data/lib/stripe/rails/version.rb +1 -1
- data/lib/stripe/rails.rb +1 -2
- data/stripe-rails.gemspec +0 -1
- data/test/stripe_initializers_spec.rb +9 -0
- data/test/testing_spec.rb +3 -2
- metadata +3 -17
- data/lib/stripe/testing.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03a407b7ba74c65f266f9443496bc69251355f84
|
4
|
+
data.tar.gz: 5af8f232370df1d3547932002028600954e18666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4600d4ae6231a38189c80504f86acbb08672aaf36ac29df556eefa4f1e255627b5d23109c05c974b7ea2ef7c89587e77a175599650ff472b8d44c1bb36075f94
|
7
|
+
data.tar.gz: ae40a99a4a73dfebba3a76292a734fcf6928ac11dd61d7607b35838fbb4314a0e11a3247f802708d69030fa74b168dd48fe7934d4ad2344ac17410c6349e8315
|
data/.travis.yml
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
- 2.4.1
|
4
|
+
- 2.3.4
|
5
|
+
- 2.2.7
|
6
|
+
- 2.1.9
|
7
7
|
env:
|
8
8
|
global:
|
9
|
-
|
9
|
+
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct;
|
10
|
+
else git log -1 --skip 1 --pretty=format:%ct; fi)
|
10
11
|
before_script:
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
13
|
+
> ./cc-test-reporter
|
14
|
+
- chmod +x ./cc-test-reporter
|
15
|
+
- "./cc-test-reporter before-build"
|
14
16
|
script:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ `basename $BUNDLE_GEMFILE` == "Gemfile" ] && [ ${RUBY_VERSION:5:3} == "2.4" ] ; then echo "Sending Coverage..."; ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
|
20
|
-
# In the case where travis is setup to build PR updates only,
|
21
|
-
# uncomment the line below
|
22
|
-
# - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
17
|
+
- bundle exec rake
|
18
|
+
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ `basename $BUNDLE_GEMFILE` == "Gemfile"
|
19
|
+
] && [ ${RUBY_VERSION:5:3} == "2.4" ] ; then echo "Sending Coverage..."; ./cc-test-reporter
|
20
|
+
after-build --exit-code $TRAVIS_TEST_RESULT; fi
|
23
21
|
gemfile:
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
- Gemfile
|
23
|
+
- gemfiles/rails4.gemfile
|
24
|
+
- gemfiles/rails5.gemfile
|
27
25
|
matrix:
|
28
26
|
exclude:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
- rvm: 2.1.9
|
28
|
+
gemfile: Gemfile
|
29
|
+
- rvm: 2.1.9
|
30
|
+
gemfile: gemfiles/rails5.gemfile
|
31
|
+
notifications:
|
32
|
+
slack:
|
33
|
+
secure: csciM073msTrOOdVYVXdAsrx2sR3Y1BKL0VvlSsYxBJawDa8BFNl6Fw8Uz1V2n4OfnkMvMCME4I3EXsCb4Kl5omnK+7ibeCzzzkCR5VwUs5/vLY7awUfCiihSCqg5ULAp2T1whQJUl5HY9Ot62sujIUX/FUhPzdbCqaKQ7cVkUo=
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
@@ -8,10 +8,12 @@ gem "rake"
|
|
8
8
|
gem 'tzinfo'
|
9
9
|
gem 'mocha'
|
10
10
|
gem 'pry'
|
11
|
-
gem 'responders', '~> 2.0' # to support Rails 4.2
|
12
11
|
|
13
12
|
group :test do
|
14
13
|
gem 'simplecov', require: false
|
14
|
+
# NOTE: tracking master temporarily until they
|
15
|
+
# release https://github.com/rebelidealist/stripe-ruby-mock/pull/433
|
16
|
+
gem 'stripe-ruby-mock', github: 'rebelidealist/stripe-ruby-mock'
|
15
17
|
gem 'poltergeist' # required for system tests
|
16
18
|
gem 'phantomjs' # ditto
|
17
19
|
gem 'puma' # ditto
|
data/README.md
CHANGED
@@ -360,11 +360,12 @@ See the [complete listing of all stripe events][5], and the [webhook tutorial][6
|
|
360
360
|
|
361
361
|
## Unit testing
|
362
362
|
|
363
|
-
If you want to test your callbacks, you can use the `Stripe::Testing` module to send mocked Stripe events.
|
363
|
+
If you want to test your callbacks, you can use the `Stripe::Rails::Testing` module to send mocked Stripe events.
|
364
364
|
|
365
365
|
```ruby
|
366
|
+
require 'stripe/rails/testing'
|
366
367
|
test "my callback handles new subscription" do
|
367
|
-
Stripe::Testing.send_event "customer.subscription.created"
|
368
|
+
Stripe::Rails::Testing.send_event "customer.subscription.created"
|
368
369
|
# Assertions
|
369
370
|
end
|
370
371
|
```
|
@@ -372,8 +373,9 @@ end
|
|
372
373
|
You can also overwrite some event properties: ([More info](https://github.com/rebelidealist/stripe-ruby-mock#customizing-webhooks))
|
373
374
|
|
374
375
|
```ruby
|
376
|
+
require 'stripe/rails/testing'
|
375
377
|
test "my callback handles new subscription" do
|
376
|
-
Stripe::Testing.send_event "customer.subscription.created", {
|
378
|
+
Stripe::Rails::Testing.send_event "customer.subscription.created", {
|
377
379
|
:email => "john@doe.com",
|
378
380
|
:account_balance => 40
|
379
381
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'stripe_mock'
|
3
|
+
rescue LoadError
|
4
|
+
warn %q{Please add "gem 'stripe-ruby-mock', group: 'test'"" to the Gemfile to use Stripe::Rails::Testing"}
|
5
|
+
exit
|
6
|
+
end
|
7
|
+
require 'stripe/callbacks'
|
8
|
+
|
9
|
+
module Stripe
|
10
|
+
module Rails
|
11
|
+
module Testing
|
12
|
+
def self.send_event(event, properties = {})
|
13
|
+
evt = StripeMock.mock_webhook_event(event, properties)
|
14
|
+
target = evt.data.object
|
15
|
+
::Stripe::Callbacks.run_callbacks(evt, target)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/stripe/rails/version.rb
CHANGED
data/lib/stripe/rails.rb
CHANGED
data/stripe-rails.gemspec
CHANGED
@@ -60,4 +60,13 @@ describe "Configuring the stripe engine" do
|
|
60
60
|
Dummy.const_defined?(:ModuleWithCallbacks).must_equal true
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
describe 'setting stripe.api_key' do
|
65
|
+
subject { app.config.stripe.api_key = 'XYZ' }
|
66
|
+
let(:warning_msg) { "[DEPRECATION] to align with stripe nomenclature, stripe.api_key has been renamed to config.stripe.secret_key\n" }
|
67
|
+
|
68
|
+
it 'should output a warning' do
|
69
|
+
-> { subject }.must_output '', warning_msg
|
70
|
+
end
|
71
|
+
end
|
63
72
|
end
|
data/test/testing_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'stripe/rails/testing'
|
2
3
|
|
3
4
|
describe "Testing" do
|
4
5
|
let(:observer) { Class.new }
|
@@ -20,7 +21,7 @@ describe "Testing" do
|
|
20
21
|
end
|
21
22
|
|
22
23
|
describe '.send_event' do
|
23
|
-
subject { Stripe::Testing.send_event event_name }
|
24
|
+
subject { Stripe::Rails::Testing.send_event event_name }
|
24
25
|
|
25
26
|
describe 'when forwarding the event to the callback' do
|
26
27
|
let(:event_name) { "invoice.payment_succeeded" }
|
@@ -42,7 +43,7 @@ describe "Testing" do
|
|
42
43
|
end
|
43
44
|
|
44
45
|
describe 'when overwriting event properties' do
|
45
|
-
subject { Stripe::Testing.send_event event_name, params }
|
46
|
+
subject { Stripe::Rails::Testing.send_event event_name, params }
|
46
47
|
let(:event_name) { "invoice.payment_succeeded" }
|
47
48
|
let(:params) { { subtotal: 500, total: 1000, currency: "eur" } }
|
48
49
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-08-
|
13
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -54,20 +54,6 @@ dependencies:
|
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: stripe-ruby-mock
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '2.4'
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '2.4'
|
71
57
|
description: A gem to integrate stripe into your rails app
|
72
58
|
email:
|
73
59
|
- sengming@sanemen.com
|
@@ -107,8 +93,8 @@ files:
|
|
107
93
|
- lib/stripe/plans.rb
|
108
94
|
- lib/stripe/rails.rb
|
109
95
|
- lib/stripe/rails/tasks.rake
|
96
|
+
- lib/stripe/rails/testing.rb
|
110
97
|
- lib/stripe/rails/version.rb
|
111
|
-
- lib/stripe/testing.rb
|
112
98
|
- stripe-rails.gemspec
|
113
99
|
- test/all.rb
|
114
100
|
- test/callbacks_spec.rb
|
data/lib/stripe/testing.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'stripe_mock'
|
2
|
-
require 'stripe/callbacks'
|
3
|
-
|
4
|
-
module Stripe
|
5
|
-
module Testing
|
6
|
-
def self.send_event(event, properties = {})
|
7
|
-
evt = StripeMock.mock_webhook_event(event, properties)
|
8
|
-
target = evt.data.object
|
9
|
-
::Stripe::Callbacks.run_callbacks(evt, target)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|