stripe-rails 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95873fe1e4c135546d576191494250facd47172be4b3a91f7325ff69c3ec5723
4
- data.tar.gz: a16c59f3cdf162b62103a89332fb749a4f2c44ff45665576e4c00cc7f0637d16
3
+ metadata.gz: 71f634d5d4a82d22c99a17ecc2bfdb313564c161d9fb8113cee4046b545b056f
4
+ data.tar.gz: 62628badc191b1f737fdcbf1608e5d36cbfd264399dc94da98e9a59a2c07ff6f
5
5
  SHA512:
6
- metadata.gz: eb222107648581b675d6a1348d4e7773ed93f0f4326dd6a708a66753d08fcad6a5e2a131375d397c48480570772532d0ec3ccf242739ada5d08417c18a9fb9d7
7
- data.tar.gz: dab6fd8cae0e0a23dca3281b63f2734c3252dff6f9b3bd3dc431e75ab425a7ef1418087234493b950f2e0d303777a03f24911a539815890422a525cab0418998
6
+ metadata.gz: 99cab9c0756eae42185a33ca6a62f9ff3038e912b7f10492a9fa400b18663576cac483441041e805c34b603f38d67763bb639323bdb238033ff043d03c512a26
7
+ data.tar.gz: 8969c43692b09fd949fbb0d6bb810e79fa7a1efab27c73e9147edf2ded0d16da1cc295ec09a7ddef8832932ce8460c50650f16a602766f299e97e0d04fcd1693
@@ -1,6 +1,12 @@
1
1
  name: Ruby
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
4
10
 
5
11
  jobs:
6
12
  build:
@@ -9,7 +15,7 @@ jobs:
9
15
  strategy:
10
16
  matrix:
11
17
  ruby: [2.4.x, 2.5.x, 2.6.x]
12
- gemfile: [Gemfile, gemfiles/rails4.gemfile]
18
+ gemfile: [Gemfile, gemfiles/rails51.gemfile, gemfiles/rails52.gemfile, gemfiles/rails4.gemfile]
13
19
 
14
20
  steps:
15
21
  - uses: actions/checkout@v1
@@ -32,6 +38,6 @@ jobs:
32
38
  gem install bundler -v 1.17.3
33
39
  bundle install --jobs 4 --retry 3
34
40
  bundle exec rake
35
- if [ `basename $BUNDLE_GEMFILE` == "Gemfile" ] && [ $RUBY_VERSION == "2.6.x" ] ;
41
+ if [ `basename $BUNDLE_GEMFILE` == "Gemfile" ] && [ $RUBY_VERSION == "2.6.x" ] && [ ! -z ${CC_TEST_REPORTER_ID} ] ;
36
42
  then ./cc-test-reporter after-build --exit-code $? ;
37
43
  fi
@@ -1,3 +1,11 @@
1
+ ## Unreleased
2
+
3
+ -
4
+
5
+ ## 1.10.1 (2020-05-29)
6
+
7
+ - adds missing callbacks for `payment_intent`. Thanks @klapperkopp .
8
+
1
9
  ## 1.10.0 (2020-03-31)
2
10
 
3
11
  - Adds support for using multiple tiers in a plan, thanks @cpsoinos
@@ -0,0 +1,20 @@
1
+ source :rubygems
2
+
3
+ gem 'rails', '~> 5.1.0'
4
+
5
+ gem 'rake'
6
+ gem 'responders'
7
+ gem 'sprockets', '< 4'
8
+ gem 'stripe'
9
+
10
+ group :test do
11
+ gem 'mocha'
12
+ gem 'simplecov', require: false
13
+ gem 'stripe-ruby-mock'
14
+ gem 'webmock'
15
+ # Required for system tests
16
+ gem 'capybara'
17
+ gem 'puma'
18
+ gem 'selenium-webdriver'
19
+ gem 'webdrivers'
20
+ end
@@ -0,0 +1,20 @@
1
+ source :rubygems
2
+
3
+ gem 'rails', '~> 5.2.0'
4
+
5
+ gem 'rake'
6
+ gem 'responders'
7
+ gem 'sprockets', '< 4'
8
+ gem 'stripe'
9
+
10
+ group :test do
11
+ gem 'mocha'
12
+ gem 'simplecov', require: false
13
+ gem 'stripe-ruby-mock'
14
+ gem 'webmock'
15
+ # Required for system tests
16
+ gem 'capybara'
17
+ gem 'puma'
18
+ gem 'selenium-webdriver'
19
+ gem 'webdrivers'
20
+ end
@@ -63,8 +63,10 @@ module Stripe
63
63
  callback 'order.updated'
64
64
  callback 'order_return.created'
65
65
  callback 'payment_intent.amount_capturable_updated'
66
+ callback 'payment_intent.canceled'
66
67
  callback 'payment_intent.created'
67
68
  callback 'payment_intent.payment_failed'
69
+ callback 'payment_intent.processing'
68
70
  callback 'payment_intent.succeeded'
69
71
  callback 'payment_method.attached'
70
72
  callback 'payment_method.card_automatically_updated'
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module Rails
3
- VERSION = '1.10.0'.freeze
3
+ VERSION = '1.10.1'.freeze
4
4
  end
5
5
  end
@@ -31,9 +31,9 @@ describe Stripe::Callbacks do
31
31
  describe 'when it is invoked for the invoice.payment_succeeded event' do
32
32
  it 'is invoked for the invoice.payment_succeeded event' do
33
33
  subject
34
- @event.wont_be_nil
35
- @event.type.must_equal 'invoice.payment_succeeded'
36
- @target.total.must_equal 6999
34
+ _(@event).wont_be_nil
35
+ _(@event.type).must_equal 'invoice.payment_succeeded'
36
+ _(@target.total).must_equal 6999
37
37
  end
38
38
  end
39
39
 
@@ -42,7 +42,7 @@ describe Stripe::Callbacks do
42
42
 
43
43
  it 'the invoice.payment_succeeded callback is not invoked' do
44
44
  subject
45
- @event.must_be_nil
45
+ _(@event).must_be_nil
46
46
  end
47
47
  end
48
48
 
@@ -50,7 +50,7 @@ describe Stripe::Callbacks do
50
50
  before { run_callback_with(callback) { fail } }
51
51
 
52
52
  it 'causes the whole webhook to fail' do
53
- ->{ subject }.must_raise RuntimeError
53
+ _(-> { subject }).must_raise RuntimeError
54
54
  end
55
55
  end
56
56
  end
@@ -61,8 +61,8 @@ describe Stripe::Callbacks do
61
61
 
62
62
  it 'does not cause the webhook to fail' do
63
63
  subject
64
- last_response.status.must_be :>=, 200
65
- last_response.status.must_be :<, 300
64
+ _(last_response.status).must_be :>=, 200
65
+ _(last_response.status).must_be :<, 300
66
66
  end
67
67
  end
68
68
 
@@ -75,7 +75,7 @@ describe Stripe::Callbacks do
75
75
 
76
76
  it 'it will be run' do
77
77
  subject
78
- events.first.type.must_equal 'invoice.payment_failed'
78
+ _(events.first.type).must_equal 'invoice.payment_failed'
79
79
  end
80
80
  end
81
81
 
@@ -84,7 +84,7 @@ describe Stripe::Callbacks do
84
84
 
85
85
  it 'it will be run' do
86
86
  subject
87
- events.first.type.must_equal 'foo.bar.baz'
87
+ _(events.first.type).must_equal 'foo.bar.baz'
88
88
  end
89
89
  end
90
90
  end
@@ -109,7 +109,7 @@ describe Stripe::Callbacks do
109
109
  describe 'when a prior attribute was not specified' do
110
110
  it 'does not fire events' do
111
111
  subject
112
- events.length.must_equal 0
112
+ _(events.length).must_equal 0
113
113
  end
114
114
  end
115
115
 
@@ -117,7 +117,7 @@ describe Stripe::Callbacks do
117
117
  before { @stubbed_event.data.previous_attributes['closed'] = true }
118
118
  it 'fires events' do
119
119
  subject
120
- events.length.must_equal 1
120
+ _(events.length).must_equal 1
121
121
  end
122
122
  end
123
123
  end
@@ -134,7 +134,7 @@ describe Stripe::Callbacks do
134
134
  describe 'when a prior attribute was not specified' do
135
135
  it 'does not fire events' do
136
136
  subject
137
- events.length.must_equal 0
137
+ _(events.length).must_equal 0
138
138
  end
139
139
  end
140
140
 
@@ -142,7 +142,7 @@ describe Stripe::Callbacks do
142
142
  before { @stubbed_event.data.previous_attributes['subtotal'] = 699 }
143
143
  it 'fire events' do
144
144
  subject
145
- events.length.must_equal 1
145
+ _(events.length).must_equal 1
146
146
  end
147
147
  end
148
148
  end
@@ -159,7 +159,7 @@ describe Stripe::Callbacks do
159
159
  describe 'when the lambda is not true' do
160
160
  it 'does not fire events' do
161
161
  subject
162
- events.length.must_equal 0
162
+ _(events.length).must_equal 0
163
163
  end
164
164
  end
165
165
 
@@ -167,7 +167,7 @@ describe Stripe::Callbacks do
167
167
  before { @stubbed_event.data.previous_attributes['closed'] = 'false' }
168
168
  it 'fires events' do
169
169
  subject
170
- events.length.must_equal 1
170
+ _(events.length).must_equal 1
171
171
  end
172
172
  end
173
173
  end
@@ -13,7 +13,7 @@ describe 'building coupons' do
13
13
  end
14
14
  end
15
15
  it "allows a single redemption by default" do
16
- @coupon.max_redemptions.must_equal 1
16
+ _(@coupon.max_redemptions).must_equal 1
17
17
  end
18
18
  end
19
19
 
@@ -33,8 +33,8 @@ describe 'building coupons' do
33
33
  after {Stripe::Coupons.send(:remove_const, :GOLD25)}
34
34
 
35
35
  it 'is accessible via hash lookup (symbol/string agnostic)' do
36
- Stripe::Coupons[:gold25].must_equal Stripe::Coupons::GOLD25
37
- Stripe::Coupons['gold25'].must_equal Stripe::Coupons::GOLD25
36
+ _(Stripe::Coupons[:gold25]).must_equal Stripe::Coupons::GOLD25
37
+ _(Stripe::Coupons['gold25']).must_equal Stripe::Coupons::GOLD25
38
38
  end
39
39
 
40
40
  describe 'uploading' do
@@ -116,7 +116,7 @@ describe 'building coupons' do
116
116
  end
117
117
  describe 'with missing mandatory values' do
118
118
  it 'raises an exception after configuring it' do
119
- proc {Stripe.coupon(:bad) {}}.must_raise Stripe::InvalidConfigurationError
119
+ _(proc {Stripe.coupon(:bad) {}}).must_raise Stripe::InvalidConfigurationError
120
120
  end
121
121
  end
122
122
  end
@@ -12,6 +12,6 @@ describe ApisController do
12
12
  describe 'the ping interface' do
13
13
  subject { get '/apis/' }
14
14
 
15
- it { subject.must_be :ok? }
15
+ it { _(subject).must_be :ok? }
16
16
  end
17
17
  end
@@ -24,7 +24,7 @@ describe Stripe::EventsController do
24
24
  end
25
25
  subject { post '/stripe/events', params.to_json }
26
26
 
27
- it { subject.must_be :ok? }
27
+ it { _(subject).must_be :ok? }
28
28
  end
29
29
 
30
30
  describe 'signed webhooks' do
@@ -50,12 +50,12 @@ describe Stripe::EventsController do
50
50
 
51
51
  it 'returns bad_request when invalid' do
52
52
  Stripe::Webhook.expects(:construct_event).raises(Stripe::SignatureVerificationError.new('msg', 'sig_header'))
53
- subject.must_be :bad_request?
53
+ _(subject).must_be :bad_request?
54
54
  end
55
55
 
56
56
  it 'returns ok when valid' do
57
57
  Stripe::Webhook.expects(:construct_event).returns(Stripe::Event.construct_from(params))
58
- subject.must_be :ok?
58
+ _(subject).must_be :ok?
59
59
  end
60
60
  end
61
61
 
@@ -82,12 +82,12 @@ describe Stripe::EventsController do
82
82
 
83
83
  it 'returns bad_request when invalid' do
84
84
  Stripe::Webhook.expects(:construct_event).twice.raises(Stripe::SignatureVerificationError.new('msg', 'sig_header'))
85
- subject.must_be :bad_request?
85
+ _(subject).must_be :bad_request?
86
86
  end
87
87
 
88
88
  it 'returns ok when valid' do
89
89
  Stripe::Webhook.expects(:construct_event).returns(Stripe::Event.construct_from(params))
90
- subject.must_be :ok?
90
+ _(subject).must_be :ok?
91
91
  end
92
92
  end
93
93
  end
@@ -8,13 +8,13 @@ describe Stripe::JavascriptHelper do
8
8
  describe '#stripe_javascript_tag' do
9
9
  describe 'when no options are passed' do
10
10
  it 'should default to v3' do
11
- view.stripe_javascript_tag.must_include 'https://js.stripe.com/v3/'
11
+ _(view.stripe_javascript_tag).must_include 'https://js.stripe.com/v3/'
12
12
  end
13
13
  end
14
14
 
15
15
  describe 'when the v2 option is passed' do
16
16
  it 'should default to v2' do
17
- view.stripe_javascript_tag(:v2).must_include 'https://js.stripe.com/v2/'
17
+ _(view.stripe_javascript_tag(:v2)).must_include 'https://js.stripe.com/v2/'
18
18
  end
19
19
  end
20
20
 
@@ -22,12 +22,12 @@ describe Stripe::JavascriptHelper do
22
22
  before { Rails.application.config.stripe.debug_js = true }
23
23
  after { Rails.application.config.stripe.debug_js = false }
24
24
  it 'should render the debug js' do
25
- view.stripe_javascript_tag(:v1).must_include 'https://js.stripe.com/v1/stripe-debug.js'
25
+ _(view.stripe_javascript_tag(:v1)).must_include 'https://js.stripe.com/v1/stripe-debug.js'
26
26
  end
27
27
 
28
28
  describe 'when v3 is selected' do
29
29
  it 'should not render debug js' do
30
- view.stripe_javascript_tag(:v3).wont_include 'https://js.stripe.com/v1/stripe-debug.js'
30
+ _(view.stripe_javascript_tag(:v3)).wont_include 'https://js.stripe.com/v1/stripe-debug.js'
31
31
  end
32
32
  end
33
33
  end
@@ -37,7 +37,7 @@ describe Stripe::JavascriptHelper do
37
37
  subject { view.render :partial => 'stripe/js' }
38
38
 
39
39
  it 'should render correctly' do
40
- subject.must_include 'https://js.stripe.com/v3/'
40
+ _(subject).must_include 'https://js.stripe.com/v3/'
41
41
  end
42
42
  end
43
43
 
@@ -45,35 +45,35 @@ describe Stripe::JavascriptHelper do
45
45
  subject { view.render :partial => 'stripe/js', locals: {stripe_js_version: 'v2'} }
46
46
 
47
47
  it 'should render correctly' do
48
- subject.must_include 'https://js.stripe.com/v2/'
48
+ _(subject).must_include 'https://js.stripe.com/v2/'
49
49
  end
50
50
  end
51
51
 
52
52
  describe '#stripe_elements_tag' do
53
53
  describe 'when no options are passed' do
54
54
  it 'should display the form' do
55
- view.stripe_elements_tag(
55
+ _(view.stripe_elements_tag(
56
56
  submit_path: '/charge',
57
- ).must_include 'Credit or debit card'
57
+ )).must_include 'Credit or debit card'
58
58
  end
59
59
  end
60
60
 
61
61
  describe 'with options' do
62
62
  describe 'without default js' do
63
63
  it 'wont include the default script tag' do
64
- view.stripe_elements_tag(
64
+ _(view.stripe_elements_tag(
65
65
  submit_path: '/charge',
66
66
  js_path: 'another/path'
67
- ).wont_include '<script id="stripe_elements_js">'
67
+ )).wont_include '<script id="stripe_elements_js">'
68
68
  end
69
69
  end
70
70
 
71
71
  describe 'without default css' do
72
72
  it 'wont include the default style tag' do
73
- view.stripe_elements_tag(
73
+ _(view.stripe_elements_tag(
74
74
  submit_path: '/charge',
75
75
  css_path: 'another/path'
76
- ).wont_include '<style>'
76
+ )).wont_include '<style>'
77
77
  end
78
78
  end
79
79
  end
@@ -13,6 +13,6 @@ describe Stripe::PingsController do
13
13
  describe 'the ping interface' do
14
14
  subject { get '/stripe/ping' }
15
15
 
16
- it { subject.must_be :ok? }
16
+ it { _(subject).must_be :ok? }
17
17
  end
18
18
  end
@@ -23,16 +23,16 @@ describe 'building plans' do
23
23
  after { Stripe::Plans.send(:remove_const, :PRIMO) }
24
24
 
25
25
  it 'is accessible via id' do
26
- Stripe::Plans::PRIMO.wont_be_nil
26
+ _(Stripe::Plans::PRIMO).wont_be_nil
27
27
  end
28
28
 
29
29
  it 'is accessible via collection' do
30
- Stripe::Plans.all.must_include Stripe::Plans::PRIMO
30
+ _(Stripe::Plans.all).must_include Stripe::Plans::PRIMO
31
31
  end
32
32
 
33
33
  it 'is accessible via hash lookup (symbol/string agnostic)' do
34
- Stripe::Plans[:primo].must_equal Stripe::Plans::PRIMO
35
- Stripe::Plans['primo'].must_equal Stripe::Plans::PRIMO
34
+ _(Stripe::Plans[:primo]).must_equal Stripe::Plans::PRIMO
35
+ _(Stripe::Plans['primo']).must_equal Stripe::Plans::PRIMO
36
36
  end
37
37
 
38
38
  it 'accepts a billing interval of a day' do
@@ -42,7 +42,7 @@ describe 'building plans' do
42
42
  plan.interval = 'day'
43
43
  end
44
44
 
45
- Stripe::Plans::DAILY.wont_be_nil
45
+ _(Stripe::Plans::DAILY).wont_be_nil
46
46
  end
47
47
 
48
48
  it 'accepts a billing interval of a week' do
@@ -52,7 +52,7 @@ describe 'building plans' do
52
52
  plan.interval = 'week'
53
53
  end
54
54
 
55
- Stripe::Plans::WEEKLY.wont_be_nil
55
+ _(Stripe::Plans::WEEKLY).wont_be_nil
56
56
  end
57
57
 
58
58
  it 'accepts a billing interval of a month' do
@@ -62,7 +62,7 @@ describe 'building plans' do
62
62
  plan.interval = 'month'
63
63
  end
64
64
 
65
- Stripe::Plans::MONTHLY.wont_be_nil
65
+ _(Stripe::Plans::MONTHLY).wont_be_nil
66
66
  end
67
67
 
68
68
  it 'accepts a billing interval of a year' do
@@ -72,17 +72,17 @@ describe 'building plans' do
72
72
  plan.interval = 'year'
73
73
  end
74
74
 
75
- Stripe::Plans::YEARLY.wont_be_nil
75
+ _(Stripe::Plans::YEARLY).wont_be_nil
76
76
  end
77
77
 
78
78
  it 'denies arbitrary billing intervals' do
79
- lambda {
79
+ _(lambda {
80
80
  Stripe.plan :broken do |plan|
81
81
  plan.name = 'Acme as a service BROKEN'
82
82
  plan.amount = 999
83
83
  plan.interval = 'anything'
84
84
  end
85
- }.must_raise Stripe::InvalidConfigurationError
85
+ }).must_raise Stripe::InvalidConfigurationError
86
86
  end
87
87
 
88
88
  it 'accepts a statement descriptor' do
@@ -93,55 +93,55 @@ describe 'building plans' do
93
93
  plan.statement_descriptor = 'ACME Monthly'
94
94
  end
95
95
 
96
- Stripe::Plans::DESCRIBED.wont_be_nil
96
+ _(Stripe::Plans::DESCRIBED).wont_be_nil
97
97
  end
98
98
 
99
99
  it 'denies statement descriptors that are too long' do
100
- lambda {
100
+ _(lambda {
101
101
  Stripe.plan :described do |plan|
102
102
  plan.name = 'Acme as a service'
103
103
  plan.amount = 999
104
104
  plan.interval = 'month'
105
105
  plan.statement_descriptor = 'ACME as a Service Monthly'
106
106
  end
107
- }.must_raise Stripe::InvalidConfigurationError
107
+ }).must_raise Stripe::InvalidConfigurationError
108
108
  end
109
109
 
110
110
  it 'denies invalid values for active' do
111
- lambda {
111
+ _(lambda {
112
112
  Stripe.plan :broken do |plan|
113
113
  plan.name = 'Acme as a service'
114
114
  plan.amount = 999
115
115
  plan.interval = 'month'
116
116
  plan.active = 'whatever'
117
117
  end
118
- }.must_raise Stripe::InvalidConfigurationError
118
+ }).must_raise Stripe::InvalidConfigurationError
119
119
  end
120
120
 
121
121
  it 'denies invalid values for usage_type' do
122
- lambda {
122
+ _(lambda {
123
123
  Stripe.plan :broken do |plan|
124
124
  plan.name = 'Acme as a service'
125
125
  plan.amount = 999
126
126
  plan.interval = 'month'
127
127
  plan.usage_type = 'whatever'
128
128
  end
129
- }.must_raise Stripe::InvalidConfigurationError
129
+ }).must_raise Stripe::InvalidConfigurationError
130
130
  end
131
131
 
132
132
  it 'denies invalid values for aggregate_usage' do
133
- lambda {
133
+ _(lambda {
134
134
  Stripe.plan :broken do |plan|
135
135
  plan.name = 'Acme as a service'
136
136
  plan.amount = 999
137
137
  plan.interval = 'month'
138
138
  plan.aggregate_usage = 'whatever'
139
139
  end
140
- }.must_raise Stripe::InvalidConfigurationError
140
+ }).must_raise Stripe::InvalidConfigurationError
141
141
  end
142
142
 
143
143
  it 'denies aggregate_usage if usage type is liecensed' do
144
- lambda {
144
+ _(lambda {
145
145
  Stripe.plan :broken do |plan|
146
146
  plan.name = 'Acme as a service'
147
147
  plan.amount = 999
@@ -149,30 +149,30 @@ describe 'building plans' do
149
149
  plan.usage_type = 'licensed'
150
150
  plan.aggregate_usage = 'sum'
151
151
  end
152
- }.must_raise Stripe::InvalidConfigurationError
152
+ }).must_raise Stripe::InvalidConfigurationError
153
153
  end
154
154
 
155
155
 
156
156
  it 'denies invalid values for billing_scheme' do
157
- lambda {
157
+ _(lambda {
158
158
  Stripe.plan :broken do |plan|
159
159
  plan.name = 'Acme as a service'
160
160
  plan.amount = 999
161
161
  plan.interval = 'month'
162
162
  plan.billing_scheme = 'whatever'
163
163
  end
164
- }.must_raise Stripe::InvalidConfigurationError
164
+ }).must_raise Stripe::InvalidConfigurationError
165
165
  end
166
166
 
167
167
  it 'denies invalid values for tiers_mode' do
168
- lambda {
168
+ _(lambda {
169
169
  Stripe.plan :broken do |plan|
170
170
  plan.name = 'Acme as a service'
171
171
  plan.amount = 999
172
172
  plan.interval = 'month'
173
173
  plan.tiers_mode = 'whatever'
174
174
  end
175
- }.must_raise Stripe::InvalidConfigurationError
175
+ }).must_raise Stripe::InvalidConfigurationError
176
176
  end
177
177
 
178
178
  describe 'name and product id validation' do
@@ -182,18 +182,18 @@ describe 'building plans' do
182
182
  plan.amount = 999
183
183
  plan.interval = 'month'
184
184
  end
185
- Stripe::Plans::PRODDED.wont_be_nil
185
+ _(Stripe::Plans::PRODDED).wont_be_nil
186
186
  end
187
187
 
188
188
  it 'should be invalid when using both name and product id' do
189
- lambda {
189
+ _(lambda {
190
190
  Stripe.plan :broken do |plan|
191
191
  plan.name = 'Acme as a service'
192
192
  plan.product_id = 'acme'
193
193
  plan.amount = 999
194
194
  plan.interval = 'month'
195
195
  end
196
- }.must_raise Stripe::InvalidConfigurationError
196
+ }).must_raise Stripe::InvalidConfigurationError
197
197
  end
198
198
  end
199
199
 
@@ -419,7 +419,7 @@ describe 'building plans' do
419
419
 
420
420
  describe 'with missing mandatory values' do
421
421
  it 'raises an exception after configuring it' do
422
- proc {Stripe.plan(:bad) {}}.must_raise Stripe::InvalidConfigurationError
422
+ _(-> { Stripe.plan(:bad) {} }).must_raise Stripe::InvalidConfigurationError
423
423
  end
424
424
  end
425
425
 
@@ -446,28 +446,28 @@ describe 'building plans' do
446
446
  after { Stripe::Plans.send(:remove_const, :PRIMO_PLAN) }
447
447
 
448
448
  it 'is accessible via upcased constant_name' do
449
- Stripe::Plans::PRIMO_PLAN.wont_be_nil
449
+ _(Stripe::Plans::PRIMO_PLAN).wont_be_nil
450
450
  end
451
451
 
452
452
  it 'is accessible via collection' do
453
- Stripe::Plans.all.must_include Stripe::Plans::PRIMO_PLAN
453
+ _(Stripe::Plans.all).must_include Stripe::Plans::PRIMO_PLAN
454
454
  end
455
455
 
456
456
  it 'is accessible via hash lookup (symbol/string agnostic)' do
457
- Stripe::Plans[:primo_plan].must_equal Stripe::Plans::PRIMO_PLAN
458
- Stripe::Plans['primo_plan'].must_equal Stripe::Plans::PRIMO_PLAN
457
+ _(Stripe::Plans[:primo_plan]).must_equal Stripe::Plans::PRIMO_PLAN
458
+ _(Stripe::Plans['primo_plan']).must_equal Stripe::Plans::PRIMO_PLAN
459
459
  end
460
460
 
461
461
  describe 'constant name validation' do
462
462
  it 'should be invalid when providing a constant name that can not be used for Ruby constant' do
463
- lambda {
463
+ _(lambda {
464
464
  Stripe.plan "Primo Plan".to_sym do |plan|
465
465
  plan.name = 'Acme as a service PRIMO'
466
466
  plan.constant_name = 'PRIMO PLAN'
467
467
  plan.amount = 999
468
468
  plan.interval = 'month'
469
469
  end
470
- }.must_raise Stripe::InvalidConfigurationError
470
+ }).must_raise Stripe::InvalidConfigurationError
471
471
  end
472
472
  end
473
473
 
@@ -15,16 +15,16 @@ describe 'building products' do
15
15
  after { Stripe::Products.send(:remove_const, :PRIMO) }
16
16
 
17
17
  it 'is accessible via id' do
18
- Stripe::Products::PRIMO.wont_be_nil
18
+ _(Stripe::Products::PRIMO).wont_be_nil
19
19
  end
20
20
 
21
21
  it 'is accessible via collection' do
22
- Stripe::Products.all.must_include Stripe::Products::PRIMO
22
+ _(Stripe::Products.all).must_include Stripe::Products::PRIMO
23
23
  end
24
24
 
25
25
  it 'is accessible via hash lookup (symbol/string agnostic)' do
26
- Stripe::Products[:primo].must_equal Stripe::Products::PRIMO
27
- Stripe::Products['primo'].must_equal Stripe::Products::PRIMO
26
+ _(Stripe::Products[:primo]).must_equal Stripe::Products::PRIMO
27
+ _(Stripe::Products['primo']).must_equal Stripe::Products::PRIMO
28
28
  end
29
29
 
30
30
  describe '.put!' do
@@ -63,42 +63,42 @@ describe 'building products' do
63
63
  describe 'validations' do
64
64
  describe 'with missing mandatory values' do
65
65
  it 'raises an exception after configuring it' do
66
- lambda { Stripe.product(:bad){} }.must_raise Stripe::InvalidConfigurationError
66
+ _(lambda { Stripe.product(:bad){} }).must_raise Stripe::InvalidConfigurationError
67
67
  end
68
68
  end
69
69
 
70
70
  describe 'invalid type' do
71
71
  it 'raises an exception during configuration' do
72
- lambda {
72
+ _(lambda {
73
73
  Stripe.product :broken do |product|
74
74
  product.name = 'Acme as a service BROKEN'
75
75
  product.type = 'anything'
76
76
  end
77
- }.must_raise Stripe::InvalidConfigurationError
77
+ }).must_raise Stripe::InvalidConfigurationError
78
78
  end
79
79
  end
80
80
 
81
81
  describe 'when using an attribute only for goods' do
82
82
  it 'raises an exception during configuration' do
83
- lambda {
83
+ _(lambda {
84
84
  Stripe.product :broken do |product|
85
85
  product.name = 'Broken Service'
86
86
  product.type = 'service'
87
87
  product.caption = 'So good it is Primo'
88
88
  end
89
- }.must_raise Stripe::InvalidConfigurationError
89
+ }).must_raise Stripe::InvalidConfigurationError
90
90
  end
91
91
  end
92
92
 
93
93
  describe 'when using an attribute only for services' do
94
94
  it 'raises an exception during configuration' do
95
- lambda {
95
+ _(lambda {
96
96
  Stripe.product :broken do |product|
97
97
  product.name = 'Broken Good'
98
98
  product.type = 'good'
99
99
  product.statement_descriptor = 'SERVICE'
100
100
  end
101
- }.must_raise Stripe::InvalidConfigurationError
101
+ }).must_raise Stripe::InvalidConfigurationError
102
102
  end
103
103
  end
104
104
  end
@@ -19,16 +19,16 @@ describe "Configuring the stripe engine" do
19
19
 
20
20
  describe 'Stripe configurations' do
21
21
  it "will have valid default values" do
22
- Stripe.api_base.must_equal 'https://api.stripe.com'
23
- Stripe.api_key.must_equal 'XYZ'
24
- Stripe.api_version.must_be_nil
25
- Stripe.verify_ssl_certs.must_equal true
26
- Stripe.open_timeout.must_equal 30
27
- Stripe.read_timeout.must_equal 80
28
-
29
- app.config.stripe.endpoint.must_equal '/stripe'
30
- app.config.stripe.auto_mount.must_equal true
31
- app.config.stripe.debug_js.must_equal false
22
+ _(Stripe.api_base).must_equal 'https://api.stripe.com'
23
+ _(Stripe.api_key).must_equal 'XYZ'
24
+ _(Stripe.api_version).must_be_nil
25
+ _(Stripe.verify_ssl_certs).must_equal true
26
+ _(Stripe.open_timeout).must_equal 30
27
+ _(Stripe.read_timeout).must_equal 80
28
+
29
+ _(app.config.stripe.endpoint).must_equal '/stripe'
30
+ _(app.config.stripe.auto_mount).must_equal true
31
+ _(app.config.stripe.debug_js).must_equal false
32
32
  end
33
33
 
34
34
  subject do
@@ -45,15 +45,15 @@ describe "Configuring the stripe engine" do
45
45
  it "reads values that is set in the environment" do
46
46
  subject
47
47
 
48
- Stripe.api_base.must_equal 'http://localhost:5000'
49
- Stripe.api_key.must_equal 'SECRET_XYZ'
50
- Stripe.verify_ssl_certs.must_equal false
51
- Stripe.api_version.must_equal '2015-10-16'
52
- Stripe.open_timeout.must_equal 33
53
- Stripe.read_timeout.must_equal 88
48
+ _(Stripe.api_base).must_equal 'http://localhost:5000'
49
+ _(Stripe.api_key).must_equal 'SECRET_XYZ'
50
+ _(Stripe.verify_ssl_certs).must_equal false
51
+ _(Stripe.api_version).must_equal '2015-10-16'
52
+ _(Stripe.open_timeout).must_equal 33
53
+ _(Stripe.read_timeout).must_equal 88
54
54
 
55
- app.config.stripe.signing_secret.must_equal 'SIGNING_SECRET_XYZ'
56
- app.config.stripe.signing_secrets.length.must_equal 1
55
+ _(app.config.stripe.signing_secret).must_equal 'SIGNING_SECRET_XYZ'
56
+ _(app.config.stripe.signing_secrets.length).must_equal 1
57
57
  end
58
58
 
59
59
  it "supports multiple signing secrets" do
@@ -62,8 +62,8 @@ describe "Configuring the stripe engine" do
62
62
  app.config.stripe.signing_secrets = ['SIGNING_SECRET_XYZ', 'SIGNING_SECRET_XYZ_CONNECT']
63
63
  rerun_initializers!
64
64
 
65
- app.config.stripe.signing_secret.must_equal 'SIGNING_SECRET_XYZ'
66
- app.config.stripe.signing_secrets.length.must_equal 2
65
+ _(app.config.stripe.signing_secret).must_equal 'SIGNING_SECRET_XYZ'
66
+ _(app.config.stripe.signing_secrets.length).must_equal 2
67
67
  end
68
68
 
69
69
  end
@@ -77,8 +77,8 @@ describe "Configuring the stripe engine" do
77
77
  it 'should be eager loaded' do
78
78
  subject
79
79
 
80
- Dummy.const_defined?(:ModelWithCallbacks).must_equal true
81
- Dummy.const_defined?(:ModuleWithCallbacks).must_equal true
80
+ _(Dummy.const_defined?(:ModelWithCallbacks)).must_equal true
81
+ _(Dummy.const_defined?(:ModuleWithCallbacks)).must_equal true
82
82
  end
83
83
  end
84
84
 
@@ -87,7 +87,7 @@ describe "Configuring the stripe engine" do
87
87
  let(:warning_msg) { "[DEPRECATION] to align with stripe nomenclature, stripe.api_key has been renamed to config.stripe.secret_key\n" }
88
88
 
89
89
  it 'should output a warning' do
90
- -> { subject }.must_output '', warning_msg
90
+ _(-> { subject }).must_output '', warning_msg
91
91
  end
92
92
  end
93
93
  end
@@ -28,8 +28,8 @@ describe "Testing" do
28
28
 
29
29
  it 'the callback must run' do
30
30
  subject
31
- event.wont_be_nil
32
- event.type.must_equal "invoice.payment_succeeded"
31
+ _(event).wont_be_nil
32
+ _(event.type).must_equal "invoice.payment_succeeded"
33
33
  end
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ describe "Testing" do
38
38
 
39
39
  it 'the callback must not run' do
40
40
  subject
41
- event.must_be_nil
41
+ _(event).must_be_nil
42
42
  end
43
43
  end
44
44
 
@@ -49,11 +49,11 @@ describe "Testing" do
49
49
 
50
50
  it 'the callback should run with overwritten properties' do
51
51
  subject
52
- event.wont_be_nil
53
- event.type.must_equal "invoice.payment_succeeded"
54
- target.subtotal.must_equal 500
55
- target.total.must_equal 1000
56
- target.currency.must_equal "eur"
52
+ _(event).wont_be_nil
53
+ _(event.type).must_equal "invoice.payment_succeeded"
54
+ _(target.subtotal).must_equal 500
55
+ _(target.total).must_equal 1000
56
+ _(target.currency).must_equal "eur"
57
57
  end
58
58
  end
59
59
  end
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.10.0
4
+ version: 1.10.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: 2020-03-31 00:00:00.000000000 Z
13
+ date: 2020-05-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -88,6 +88,8 @@ files:
88
88
  - config/locales/en.yml
89
89
  - config/routes.rb
90
90
  - gemfiles/rails4.gemfile
91
+ - gemfiles/rails51.gemfile
92
+ - gemfiles/rails52.gemfile
91
93
  - lib/generators/stripe/install_generator.rb
92
94
  - lib/generators/templates/coupons.rb
93
95
  - lib/generators/templates/plans.rb
@@ -185,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
187
  - !ruby/object:Gem::Version
186
188
  version: '0'
187
189
  requirements: []
188
- rubygems_version: 3.0.3
190
+ rubygems_version: 3.1.2
189
191
  signing_key:
190
192
  specification_version: 4
191
193
  summary: A gem to integrate stripe into your rails app