Class: MockServer

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_server.rb

Defined Under Namespace

Modules: Methods Classes: App

Instance Method Summary collapse

Constructor Details

#initialize(app, port = 4000, &block) ⇒ MockServer

Returns a new instance of MockServer.



9
10
11
12
# File 'lib/mock_server.rb', line 9

def initialize(app, port = 4000, &block)
  @app = app
  @port = port
end

Instance Method Details

#startObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mock_server.rb', line 14

def start
  Thread.new do
    with_quiet_logger do |logger|
      Rack::Handler::WEBrick.run(@app, :Port => @port, :Logger => logger, :AccessLog => [])
    end
  end

  wait_for_service("0.0.0.0", @port)

  self
end