module TinyGate::TestHelper

Constants

DummyServer

Public Class Methods

init!() click to toggle source
# File lib/tiny_gate/test_helper.rb, line 18
def self.init!
  TinyGate::Client.configure do |config|
    config.root_url = TinyGate::TestHelper::UserClient::ROOT_URL
  end
end
run_server() click to toggle source
# File lib/tiny_gate/test_helper.rb, line 24
def self.run_server
  Rack::Handler::WEBrick.run(
    DummyServer,
    Host: 'localhost',
    Port: 31338
  )
end
start_server() click to toggle source
# File lib/tiny_gate/test_helper.rb, line 32
def self.start_server
  Daemons.call(multiple: true, shush: true) do
    run_server
  end
  sleep 1
end
stop_server() click to toggle source
# File lib/tiny_gate/test_helper.rb, line 39
def self.stop_server
  return unless Daemons.group

  Daemons.group.applications.each do |application|
    begin
      Process.kill('KILL', application.pid.pid)
      Process.wait(application.pid.pid)
    rescue
    end
  end
end