Sha256: 48a6ccac1e8a54e58befa0d2a621aa5addbf3a8b424c3a5d202a092e8ae6160f

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

require 'rack'
require 'puma'
require 'rack/handler/puma'

class PatronTestServer
  APP = Rack::Builder.new { eval(File.read(File.dirname(__FILE__) + '/config.ru')) }

  def self.start(ssl = false, port = 9001 )
    @ssl = ssl
    keypath = File.expand_path(File.read(File.dirname(__FILE__) + '/../certs/privkey.pem'))
    certpath = File.expand_path(File.read(File.dirname(__FILE__) + '/../certs/cacert.pem'))

    host = if ssl
      'ssl://127.0.0.1:%d?key=%s&cert=%s' % [port, keypath, certpath]
    else
      'tcp://127.0.0.1:%d' % port
    end
    Rack::Handler::Puma.run(APP, {:Port => port.to_i, :Verbose => true, :Host => '0.0.0.0'})
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
patron-0.13.1 spec/support/test_server.rb
patron-0.12.1 spec/support/test_server.rb
patron-0.12.0 spec/support/test_server.rb