Module: RSpec::Httpd::Server
Constant Summary collapse
- MAX_STARTUP_TIME =
10
Instance Method Summary collapse
- #logger ⇒ Object
-
#start!(host: "0.0.0.0", port:, command:, logger: nil) ⇒ Object
builds and returns a server object.
Instance Method Details
#logger ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rspec/httpd/server.rb', line 18 def logger # If this file is required as-is, without loading all of rspec/httpd, # ::RSpec::Httpd does not provide a logger. In that case we polyfill # a default logger to STDERR. # # Doing so lets use this file as is; which lets one use the # # RSpec::Httpd::Server.start! ... # # method. if ::RSpec::Httpd.respond_to?(:logger) ::RSpec::Httpd.logger else @logger ||= ::Logger.new(STDERR, level: :info) end end |
#start!(host: "0.0.0.0", port:, command:, logger: nil) ⇒ Object
builds and returns a server object.
You can use this method to retrieve a client connection to a server specified via host:, port:, and, optionally, a command.
39 40 41 42 43 |
# File 'lib/rspec/httpd/server.rb', line 39 def start!(host: "0.0.0.0", port:, command:, logger: nil) @servers ||= {} @servers[[host, port, command]] ||= do_start(host, port, command) @logger = logger if logger end |