Module: RSpec::Support::RandomPort
- Defined in:
- lib/hanami/devtools/integration/random_port.rb
Overview
Returns a random, non-sudo, free port
Constant Summary collapse
- HOST =
"localhost"- PORT_RANGE =
1024..65_535
- TIMEOUT =
second
1
Class Method Summary collapse
Class Method Details
.call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hanami/devtools/integration/random_port.rb', line 16 def self.call result = -1 loop do result = Kernel.rand(PORT_RANGE) break unless open?(result) end result end |