stripe-rails 1.8.2 → 2.0.0.pre

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.
@@ -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
@@ -1,8 +1,3 @@
1
- require File.expand_path("null_system_test_case", __dir__)
2
-
3
- # For Rails 4 compat
4
- SystemTestCaseKlass = defined?(ActionDispatch::SystemTestCase) ? ActionDispatch::SystemTestCase : NullSystemTestCase
5
-
6
- class ApplicationSystemTestCase < SystemTestCaseKlass
1
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
7
2
  driven_by :selenium_chrome_headless
8
- end
3
+ 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.8.2
4
+ version: 2.0.0.pre
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: 2019-08-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
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '3'
21
+ version: '5.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '3'
28
+ version: '5.1'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: stripe
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.36.2
35
+ version: 3.15.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.36.2
42
+ version: 3.15.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: responders
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -78,21 +78,21 @@ files:
78
78
  - app/assets/stripe/stripe_elements.js
79
79
  - app/controllers/stripe/application_controller.rb
80
80
  - app/controllers/stripe/events_controller.rb
81
- - app/controllers/stripe/pings_controller.rb
82
81
  - app/helpers/stripe/javascript_helper.rb
83
82
  - app/models/stripe/event_dispatch.rb
84
- - app/models/stripe/ping.rb
85
83
  - app/views/stripe/_elements.html.erb
86
84
  - app/views/stripe/_elements_js.html.erb
87
85
  - app/views/stripe/_js.html.erb
88
86
  - config/locales/en.yml
89
87
  - config/routes.rb
90
- - gemfiles/rails4.gemfile
88
+ - gemfiles/rails51.gemfile
89
+ - gemfiles/rails52.gemfile
91
90
  - lib/generators/stripe/install_generator.rb
92
91
  - lib/generators/templates/coupons.rb
93
92
  - lib/generators/templates/plans.rb
94
93
  - lib/generators/templates/products.rb
95
94
  - lib/stripe-rails.rb
95
+ - lib/stripe/billing_tier.rb
96
96
  - lib/stripe/callbacks.rb
97
97
  - lib/stripe/callbacks/builder.rb
98
98
  - lib/stripe/configuration_builder.rb
@@ -155,7 +155,6 @@ files:
155
155
  - test/fixtures/stripe_plans_headers_2017.json
156
156
  - test/invoice.json
157
157
  - test/javascript_helper_spec.rb
158
- - test/pings_controller_spec.rb
159
158
  - test/plan_builder_spec.rb
160
159
  - test/product_builder_spec.rb
161
160
  - test/spec_helper.rb
@@ -163,7 +162,6 @@ files:
163
162
  - test/support/application_system_test_case.rb
164
163
  - test/support/callback_helpers.rb
165
164
  - test/support/fixture_loader.rb
166
- - test/support/null_system_test_case.rb
167
165
  - test/testing_spec.rb
168
166
  homepage: https://github.com/tansengming/stripe-rails
169
167
  licenses:
@@ -180,11 +178,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
178
  version: '0'
181
179
  required_rubygems_version: !ruby/object:Gem::Requirement
182
180
  requirements:
183
- - - ">="
181
+ - - ">"
184
182
  - !ruby/object:Gem::Version
185
- version: '0'
183
+ version: 1.3.1
186
184
  requirements: []
187
- rubygems_version: 3.0.3
185
+ rubygems_version: 3.1.2
188
186
  signing_key:
189
187
  specification_version: 4
190
188
  summary: A gem to integrate stripe into your rails app
@@ -238,7 +236,6 @@ test_files:
238
236
  - test/fixtures/stripe_plans_headers_2017.json
239
237
  - test/invoice.json
240
238
  - test/javascript_helper_spec.rb
241
- - test/pings_controller_spec.rb
242
239
  - test/plan_builder_spec.rb
243
240
  - test/product_builder_spec.rb
244
241
  - test/spec_helper.rb
@@ -246,5 +243,4 @@ test_files:
246
243
  - test/support/application_system_test_case.rb
247
244
  - test/support/callback_helpers.rb
248
245
  - test/support/fixture_loader.rb
249
- - test/support/null_system_test_case.rb
250
246
  - test/testing_spec.rb
@@ -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=
@@ -1,10 +0,0 @@
1
- module Stripe
2
- class PingsController < ::Stripe::ApplicationController
3
- respond_to :json
4
-
5
- def show
6
- @ping = Ping.new
7
- respond_with @ping
8
- end
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- module Stripe
2
- class Ping
3
- attr_reader :message
4
-
5
- def initialize
6
- @message = "Your sound card works perfectly!"
7
- end
8
- end
9
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Stripe::PingsController do
4
- parallelize_me!
5
- include Rack::Test::Methods
6
-
7
- let(:app) { Rails.application }
8
- before do
9
- header 'Accept', 'application/json'
10
- header 'Content-Type', 'application/json'
11
- end
12
-
13
- describe 'the ping interface' do
14
- subject { get '/stripe/ping' }
15
-
16
- it { subject.must_be :ok? }
17
- end
18
- end
@@ -1,11 +0,0 @@
1
- class NullSystemTestCase
2
- def self.driven_by(*_)
3
- end
4
-
5
- def self.setup
6
- end
7
-
8
- def self.test(_)
9
- warn 'WARNING: Skipping system test because this version of Rails does not support it!'
10
- end
11
- end