mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Start mongrel with an open port, not a constant
This commit is contained in:
parent
acb95ec1a8
commit
f6cb0c2140
1 changed files with 8 additions and 1 deletions
|
@ -4,7 +4,14 @@ require 'lib/httparty'
|
|||
require 'spec/expectations'
|
||||
|
||||
Before do
|
||||
port = ENV["HTTPARTY_PORT"] || 31981
|
||||
def new_port
|
||||
server = TCPServer.new('0.0.0.0', nil)
|
||||
port = server.addr[1]
|
||||
ensure
|
||||
server.close
|
||||
end
|
||||
|
||||
port = ENV["HTTPARTY_PORT"] || new_port
|
||||
@host_and_port = "0.0.0.0:#{port}"
|
||||
@server = Mongrel::HttpServer.new("0.0.0.0", port)
|
||||
@server.run
|
||||
|
|
Loading…
Add table
Reference in a new issue