fake_stripe 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -7
- data/lib/fake_stripe.rb +2 -2
- data/lib/fake_stripe/stub_stripe_js.rb +11 -2
- data/lib/fake_stripe/utils.rb +14 -0
- data/lib/fake_stripe/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e83c6e7c0077e6017382efc3785916d7e9c8ed
|
4
|
+
data.tar.gz: 72c506491392d9ee13eb6d000342cca5946d4c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b62fe6dae65655deb06638bb064cf0136848ac65c2fc0bd9697143c47928835e1c3b36a72f51de710655cf20fe5bd9c18f870a652ae005327f8f18c55b41a9b
|
7
|
+
data.tar.gz: b993495c1dabda170cb5f2bb4c160749ba55989fadb0d2ea2b19e08a7b1b5a56d09e0d2e91401bd9c33741a09d4c7b7d042e683e7a4739a2d1a1075a63488956
|
data/README.md
CHANGED
@@ -21,13 +21,6 @@ end
|
|
21
21
|
|
22
22
|
Remember to run `bundle install`.
|
23
23
|
|
24
|
-
### Rails 5 Compatibility
|
25
|
-
|
26
|
-
`fake_stripe` depends on Sinatra, which is currently in the process of being
|
27
|
-
upgraded to use Rack 2.0, a requirement for compatibility with Rails 5. This
|
28
|
-
should be resolved once Sinatra 2.0 is officially released; in the meantime,
|
29
|
-
you can add `gem 'sinatra', '2.0.0.beta2'` to the `:test` group in your Gemfile.
|
30
|
-
|
31
24
|
### Stripe settings
|
32
25
|
|
33
26
|
Set the `STRIPE_JS_HOST` constant in an initializer:
|
data/lib/fake_stripe.rb
CHANGED
@@ -32,9 +32,9 @@ module FakeStripe
|
|
32
32
|
def self.stub_stripe
|
33
33
|
Stripe.api_key = 'FAKE_STRIPE_API_KEY'
|
34
34
|
FakeStripe.reset
|
35
|
+
FakeStripe::StubStripeJS.boot_once
|
35
36
|
stub_request(:any, /api.stripe.com/).to_rack(FakeStripe::StubApp)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
|
-
|
40
|
-
STRIPE_JS_HOST = "http://#{server.host}:#{server.port}"
|
40
|
+
STRIPE_JS_HOST = "http://localhost:#{FakeStripe::StubStripeJS.server_port}"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'capybara'
|
2
2
|
require 'capybara/server'
|
3
|
+
require 'fake_stripe/utils'
|
3
4
|
require 'sinatra/base'
|
4
5
|
|
5
6
|
module FakeStripe
|
@@ -21,9 +22,17 @@ module FakeStripe
|
|
21
22
|
IO.read(file_path) + IO.read(mock_file_path)
|
22
23
|
end
|
23
24
|
|
24
|
-
def self.boot
|
25
|
+
def self.boot(port = FakeStripe::Utils.find_available_port)
|
25
26
|
instance = new
|
26
|
-
Capybara::Server.new(instance).tap { |server| server.boot }
|
27
|
+
Capybara::Server.new(instance, port).tap { |server| server.boot }
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.boot_once
|
31
|
+
@@stripe_js_server ||= FakeStripe::StubStripeJS.boot(self.server_port)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.server_port
|
35
|
+
@@stripe_js_port ||= FakeStripe::Utils.find_available_port
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
data/lib/fake_stripe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harlow Ward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- lib/fake_stripe/initializers/webmock.rb
|
188
188
|
- lib/fake_stripe/stub_app.rb
|
189
189
|
- lib/fake_stripe/stub_stripe_js.rb
|
190
|
+
- lib/fake_stripe/utils.rb
|
190
191
|
- lib/fake_stripe/version.rb
|
191
192
|
homepage: https://github.com/thoughtbot/fake_stripe
|
192
193
|
licenses: []
|
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
208
|
version: '0'
|
208
209
|
requirements: []
|
209
210
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.6.
|
211
|
+
rubygems_version: 2.6.13
|
211
212
|
signing_key:
|
212
213
|
specification_version: 4
|
213
214
|
summary: A fake Stripe server.
|