123456789_123456789_123456789_123456789_123456789_

Module: TestPuma

Constant Summary

Instance Method Summary

Instance Method Details

#bind_uri_str

[ GitHub ]

  
# File 'test/helpers/test_puma.rb', line 49

def bind_uri_str
  if @bind_port
    "tcp://#{HOST}:#{@bind_port}"
  elsif @bind_path
    "unix://#{HOST}:#{@bind_path}"
  end
end

#control_uri_str

[ GitHub ]

  
# File 'test/helpers/test_puma.rb', line 57

def control_uri_str
  if @control_port
    "tcp://#{HOST}:#{@control_port}"
  elsif @control_path
    "unix://#{HOST}:#{@control_path}"
  end
end

#new_port(host = HOST)

Returns an available port by using TCPServer.open(host, 0)

[ GitHub ]

  
# File 'test/helpers/test_puma.rb', line 45

def new_port(host = HOST)
  TCPServer.open(host, 0) { |server| server.connect_address.ip_port }
end