Class: EacEnvs::Http::Rspec::EchoServer::HttpServer

Inherits:
WEBrick::HTTPServer
  • Object
show all
Defined in:
lib/eac_envs/http/rspec/echo_server/http_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HttpServer

Returns a new instance of HttpServer.



11
12
13
14
# File 'lib/eac_envs/http/rspec/echo_server/http_server.rb', line 11

def initialize(options)
  super
  mount '/', ::EacEnvs::Http::Rspec::EchoServer::WebrickServlet
end

Instance Method Details

#on_running(&block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eac_envs/http/rspec/echo_server/http_server.rb', line 16

def on_running(&block)
  ::Thread.abort_on_exception = true
  servlet_thread = ::Thread.new { start }
  begin
    sleep 0.001 while status != :Running
    block.call
  ensure
    shutdown
    servlet_thread.join
  end
end