1
0
Fork 0
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:
Sandro Turriate 2010-05-13 21:50:58 -04:00
parent acb95ec1a8
commit f6cb0c2140

View file

@ -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