fake_braintree 0.4.1 → 0.4.2

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: e490dbbce81677c05e0eb73532ea5471db948dd7
4
- data.tar.gz: b5090bfd54c5118b61912bacdc9bcf39956c9109
3
+ metadata.gz: 4e8fe207449b5ab83bbc108efb904aad458d4560
4
+ data.tar.gz: c7a9004feb28faa46ec51f8f0c025211534b60b7
5
5
  SHA512:
6
- metadata.gz: 3a46b7284f3489ec49d8098f651e83c72f0ce2850f372ce51fcce885b15dced400a5615f5168eabb4974ccde8fb210358a71a8732fc2af25d23c27b184c5bb01
7
- data.tar.gz: 968a51beab295415d2098710cebe4f327b3f1847f20d6daa6301284df6adf1c7635b318ae137544a47bf6679d1a06e098e00d4276453ab037f6343f2c9061aa9
6
+ metadata.gz: 1b7b3a2eb9e5170ef3ff26058d07ca6bd2b7ea8ef0670b55af185145651192d5ecfe80d7f62244195abc8ae2c8df3708c356280fc8a3c190353efb1a55fdc7d1
7
+ data.tar.gz: 70c3f140f188764b50aa34c17c4610ca40d9d238a43de53ec5cb1030ebf8c45c0ddc59ce13ce0cedfe6d7d8e583fc49effd067fc81d9d758db09021d4dc98231
data/Gemfile CHANGED
@@ -1,5 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ # Web servers for different platforms
4
+
5
+ platform :jruby do
6
+ gem 'puma'
7
+ end
8
+
9
+ platform :mri do
10
+ gem 'thin'
11
+ end
12
+
3
13
  # Specify your gem's dependencies in fake_braintree.gemspec
4
14
  gemspec
5
15
 
data/NEWS.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.4.2
2
+
3
+ * Add support for Puma server for JRuby support (#59). `fake_braintree` will
4
+ try to use Thin first and then Puma.
5
+
1
6
  # 0.4.1
2
7
 
3
8
  * Add support for `Braintree::Subscription.retry_charge`
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'i18n'
23
23
  s.add_dependency 'sinatra'
24
24
  s.add_dependency 'braintree', '~> 2.5'
25
- s.add_dependency 'thin'
26
25
 
27
26
  s.add_development_dependency 'rspec', '~> 2.12.0'
28
27
  s.add_development_dependency 'bourne', '~> 1.3'
@@ -1,10 +1,10 @@
1
1
  require 'capybara'
2
2
  require 'capybara/server'
3
- require 'rack/handler/thin'
4
3
 
5
4
  class FakeBraintree::Server
5
+
6
6
  def boot
7
- with_thin_runner do
7
+ with_runner do
8
8
  server = Capybara::Server.new(FakeBraintree::SinatraApp)
9
9
  server.boot
10
10
  ENV['GATEWAY_PORT'] = server.port.to_s
@@ -13,13 +13,25 @@ class FakeBraintree::Server
13
13
 
14
14
  private
15
15
 
16
- def with_thin_runner
16
+ def with_runner
17
17
  default_server_process = Capybara.server
18
18
  Capybara.server do |app, port|
19
- Rack::Handler::Thin.run(app, Port: port)
19
+ handler.run(app, Port: port)
20
20
  end
21
21
  yield
22
22
  ensure
23
23
  Capybara.server(&default_server_process)
24
24
  end
25
+
26
+ def handler
27
+ if defined?(Thin)
28
+ require 'rack/handler/thin'
29
+ Rack::Handler::Thin
30
+ elsif defined?(Puma)
31
+ require 'rack/handler/puma'
32
+ Rack::Handler::Puma
33
+ else
34
+ raise 'No Rack handler was defined! Please include `gem "thin"` or `gem "puma"` in your Gemfile."
35
+ end
36
+ end
25
37
  end
@@ -1,3 +1,3 @@
1
1
  module FakeBraintree
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ require 'bundler'
2
+
3
+ Bundler.require
4
+
1
5
  require 'rspec'
2
6
  require 'fake_braintree'
3
7
  require 'timecop'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot, inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.5'
83
- - !ruby/object:Gem::Dependency
84
- name: thin
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rspec
99
85
  requirement: !ruby/object:Gem::Requirement