Sha256: e576f12bd23c171068d7ef54296c651af8fc0d6ca31fa51e2a7e85d97af2798d

Contents?: true

Size: 629 Bytes

Versions: 5

Compression:

Stored size: 629 Bytes

Contents

# coding: utf-8

class BaseServer
  attr_accessor :server, :port, :logger
  
  def u(str = '')
    "http://localhost:#{@port}/#{str}"
  end
  
  def set_logger
    @io = StringIO.new
    @logger = Logger.new(@proxyio)
    @logger.level = Logger::Severity::DEBUG
  end
  
  def start
    @port = @server.config[:Port]
    @thread = start_server_thread(@server)
  end
  
  def start_server_thread(server)
    t = Thread.new {
      Thread.current.abort_on_exception = true
      server.start
    }
    while server.status != :Running
      Thread.pass
      unless t.alive?
    t.join
    raise
      end
    end
    t
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
glebtv-httpclient-3.2.4 spec/support/base_server.rb
glebtv-httpclient-3.2.3 spec/support/base_server.rb
glebtv-httpclient-3.2.2 spec/support/base_server.rb
glebtv-httpclient-3.2.1 spec/support/base_server.rb
glebtv-httpclient-3.2.0 spec/support/base_server.rb