Sha256: 89d0ae7905c917d65b4237029450a9cd66194a7015608a8bd8f738313d645030

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

require 'capybara'
require 'capybara/server'
require 'rack/handler/thin'

class FakeBraintree::Server
  def boot
    with_thin_runner do
      server = Capybara::Server.new(FakeBraintree::SinatraApp)
      server.boot
      ENV['GATEWAY_PORT'] = server.port.to_s
    end
  end

  private

  def with_thin_runner
    default_server_process = Capybara.server
    Capybara.server do |app, port|
      Rack::Handler::Thin.run(app, :Port => port)
    end
    yield
  ensure
    Capybara.server(&default_server_process)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fake_braintree-0.4 lib/fake_braintree/server.rb
fake_braintree-0.3 lib/fake_braintree/server.rb
fake_braintree-0.2.1 lib/fake_braintree/server.rb