stripe-rails 1.8.2 → 1.10.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -6,12 +6,12 @@ end
6
6
  require 'minitest/autorun'
7
7
 
8
8
  require 'webmock/minitest'
9
- WebMock.disable_net_connect!(allow_localhost: true)
9
+ WebMock.disable_net_connect! allow_localhost: true, allow: ['codeclimate.com', 'chromedriver.storage.googleapis.com']
10
10
 
11
11
  # Chrome Setup
12
12
  require 'selenium-webdriver'
13
13
  require 'capybara'
14
- require 'chromedriver-helper'
14
+ require 'webdrivers'
15
15
  Capybara.register_driver :selenium do |app|
16
16
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
17
17
  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
@@ -40,20 +40,32 @@ describe "Configuring the stripe engine" do
40
40
  app.config.stripe.open_timeout = 33
41
41
  app.config.stripe.read_timeout = 88
42
42
  rerun_initializers!
43
- end
43
+ end
44
44
 
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
+
55
+ _(app.config.stripe.signing_secret).must_equal 'SIGNING_SECRET_XYZ'
56
+ _(app.config.stripe.signing_secrets.length).must_equal 1
57
+ end
58
+
59
+ it "supports multiple signing secrets" do
60
+ subject
61
+
62
+ app.config.stripe.signing_secrets = ['SIGNING_SECRET_XYZ', 'SIGNING_SECRET_XYZ_CONNECT']
63
+ rerun_initializers!
54
64
 
55
- app.config.stripe.signing_secret.must_equal 'SIGNING_SECRET_XYZ'
65
+ _(app.config.stripe.signing_secret).must_equal 'SIGNING_SECRET_XYZ'
66
+ _(app.config.stripe.signing_secrets.length).must_equal 2
56
67
  end
68
+
57
69
  end
58
70
 
59
71
  describe 'eager loaded callbacks' do
@@ -65,8 +77,8 @@ describe "Configuring the stripe engine" do
65
77
  it 'should be eager loaded' do
66
78
  subject
67
79
 
68
- Dummy.const_defined?(:ModelWithCallbacks).must_equal true
69
- Dummy.const_defined?(:ModuleWithCallbacks).must_equal true
80
+ _(Dummy.const_defined?(:ModelWithCallbacks)).must_equal true
81
+ _(Dummy.const_defined?(:ModuleWithCallbacks)).must_equal true
70
82
  end
71
83
  end
72
84
 
@@ -75,7 +87,7 @@ describe "Configuring the stripe engine" do
75
87
  let(:warning_msg) { "[DEPRECATION] to align with stripe nomenclature, stripe.api_key has been renamed to config.stripe.secret_key\n" }
76
88
 
77
89
  it 'should output a warning' do
78
- -> { subject }.must_output '', warning_msg
90
+ _(-> { subject }).must_output '', warning_msg
79
91
  end
80
92
  end
81
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,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowell
8
8
  - Nola Stowe
9
9
  - SengMing Tan
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-08-31 00:00:00.000000000 Z
13
+ date: 2020-09-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -65,9 +65,9 @@ files:
65
65
  - ".editorconfig"
66
66
  - ".github/issue_template.md"
67
67
  - ".github/pull_request_template.md"
68
+ - ".github/workflows/ruby.yml"
68
69
  - ".gitignore"
69
70
  - ".rubocop.yml"
70
- - ".travis.yml"
71
71
  - CODE_OF_CONDUCT.md
72
72
  - Changelog.md
73
73
  - Gemfile
@@ -88,11 +88,14 @@ 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
94
96
  - lib/generators/templates/products.rb
95
97
  - lib/stripe-rails.rb
98
+ - lib/stripe/billing_tier.rb
96
99
  - lib/stripe/callbacks.rb
97
100
  - lib/stripe/callbacks/builder.rb
98
101
  - lib/stripe/configuration_builder.rb
@@ -169,7 +172,7 @@ homepage: https://github.com/tansengming/stripe-rails
169
172
  licenses:
170
173
  - MIT
171
174
  metadata: {}
172
- post_install_message:
175
+ post_install_message:
173
176
  rdoc_options: []
174
177
  require_paths:
175
178
  - lib
@@ -184,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
187
  - !ruby/object:Gem::Version
185
188
  version: '0'
186
189
  requirements: []
187
- rubygems_version: 3.0.3
188
- signing_key:
190
+ rubygems_version: 3.1.2
191
+ signing_key:
189
192
  specification_version: 4
190
193
  summary: A gem to integrate stripe into your rails app
191
194
  test_files:
@@ -1,28 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6.0
4
- - 2.5.5
5
- - 2.4.5
6
- - 2.3.8
7
- addons:
8
- chrome: stable
9
- env:
10
- global:
11
- - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct;
12
- else git log -1 --skip 1 --pretty=format:%ct; fi)
13
- before_script:
14
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
15
- > ./cc-test-reporter
16
- - chmod +x ./cc-test-reporter
17
- - "./cc-test-reporter before-build"
18
- script:
19
- - bundle exec rake
20
- - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ `basename $BUNDLE_GEMFILE` == "Gemfile"
21
- ] && [ ${RUBY_VERSION:5:3} == "2.6" ] ; then echo "Sending Coverage..."; ./cc-test-reporter
22
- after-build --exit-code $TRAVIS_TEST_RESULT; fi
23
- gemfile:
24
- - Gemfile
25
- - gemfiles/rails4.gemfile
26
- notifications:
27
- slack:
28
- secure: csciM073msTrOOdVYVXdAsrx2sR3Y1BKL0VvlSsYxBJawDa8BFNl6Fw8Uz1V2n4OfnkMvMCME4I3EXsCb4Kl5omnK+7ibeCzzzkCR5VwUs5/vLY7awUfCiihSCqg5ULAp2T1whQJUl5HY9Ot62sujIUX/FUhPzdbCqaKQ7cVkUo=