Method: Capybara.register_server

Defined in:
lib/capybara.rb

.register_server(name) {|app, port, host| ... } ⇒ Object

Register a new server for Capybara.

Capybara.register_server :webrick do |app, port, host|
  require 'rack/handler/webrick'
  Rack::Handler::WEBrick.run(app, ...)
end

Parameters:

  • name (Symbol)

    The name of the new driver

Yields:

  • (app, port, host)

    This block takes a rack app and a port and returns a rack server listening on that port

Yield Parameters:

  • app (<Rack>)

    The rack application that this server will contain.

  • port

    The port number the server should listen on

  • host

    The host/ip to bind to



150
151
152
# File 'lib/capybara.rb', line 150

def register_server(name, &block)
  servers.send(:register, name.to_sym, block)
end