module HttpTest

helper methods for port handling —————————————

Constants

VERSION

Public Class Methods

start_session(session_parameters) click to toggle source
# File lib/http-test.rb, line 5
def self.start_session(session_parameters)
  url_base, command = session_parameters.values_at :url_base, :command
  @session = Session.start! url_base: url_base, command: command
end
stop_session() click to toggle source
# File lib/http-test.rb, line 10
def self.stop_session
  @session = nil
end
url_base() click to toggle source
# File lib/http-test.rb, line 14
  def self.url_base
    return @session.url_base if @session

    STDERR.puts <<-MSG
http-test: I was unable to find a API endpoint.

Either:

- define a API endpoint via `url_base <url>`, if the test server is not controlled by this script, or
- define a command to start a test_server via `test_server "command"`

MSG

    #STDERR.puts "called from\n\t#{caller[0,6].join("\n\t")}"
    raise "Missing HttpTest session, you must run HttpTest.start_session first!"
  end