stripe-rails 1.1.0 → 1.1.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
  SHA1:
3
- metadata.gz: ac50cc61a92527aeb62ea99d1c288dd9057e2796
4
- data.tar.gz: a499347e24515c8d7ccddc7b961e62abf633e9a6
3
+ metadata.gz: 03a407b7ba74c65f266f9443496bc69251355f84
4
+ data.tar.gz: 5af8f232370df1d3547932002028600954e18666
5
5
  SHA512:
6
- metadata.gz: 077e01fe7390da6d0c3facab63783dc89d71fe9d91ba14bddc7b6b765855379d832857d2b17630898d9d9cd5be618cac8ce676cddd99e29e5a1d761846118c62
7
- data.tar.gz: 3a506cbec7767db9a96b5bf4b7c30b81dcc9f833d0904f049afee2b9aae64082e1da346a8902379e884869b473d18ca639506121cac1e10afbb4e0c3f79da50e
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
- - 2.4.1
4
- - 2.3.4
5
- - 2.2.7
6
- - 2.1.9
3
+ - 2.4.1
4
+ - 2.3.4
5
+ - 2.2.7
6
+ - 2.1.9
7
7
  env:
8
8
  global:
9
- - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
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
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
- - chmod +x ./cc-test-reporter
13
- - ./cc-test-reporter before-build
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
- - bundle exec rake
16
- # Preferably you will run test-reporter on branch update events. But
17
- # if you setup travis to build PR updates only, you don't need to run
18
- # the line below
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
- - Gemfile
25
- - gemfiles/rails4.gemfile
26
- - gemfiles/rails5.gemfile
22
+ - Gemfile
23
+ - gemfiles/rails4.gemfile
24
+ - gemfiles/rails5.gemfile
27
25
  matrix:
28
26
  exclude:
29
- - rvm: 2.1.9
30
- gemfile: Gemfile
31
- - rvm: 2.1.9
32
- gemfile: gemfiles/rails5.gemfile
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
@@ -1,3 +1,7 @@
1
+ ## 1.1.1 (2017-08-31)
2
+
3
+ * Make stripe-ruby-mock an optional dependency (thanks @gaffneyc)
4
+
1
5
  ## 1.1.0 (2017-08-29)
2
6
 
3
7
  * Adds a testing module for testing callbacks (thanks @Pyo25)
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
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module Rails
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
data/lib/stripe/rails.rb CHANGED
@@ -4,5 +4,4 @@ require 'stripe/engine'
4
4
  require 'stripe/configuration_builder'
5
5
  require 'stripe/plans'
6
6
  require 'stripe/coupons'
7
- require 'stripe/callbacks'
8
- require 'stripe/testing'
7
+ require 'stripe/callbacks'
data/stripe-rails.gemspec CHANGED
@@ -17,5 +17,4 @@ Gem::Specification.new do |gem|
17
17
  gem.add_dependency 'rails', '>= 3'
18
18
  gem.add_dependency 'stripe'
19
19
  gem.add_dependency 'responders'
20
- gem.add_dependency 'stripe-ruby-mock', '~> 2.4'
21
20
  end
@@ -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.0
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-29 00:00:00.000000000 Z
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
@@ -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