1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

use PID for port (so two tests can run in parallel)

pull requests for better logic welcome
This commit is contained in:
Konstantin Haase 2012-03-07 22:26:54 +01:00
parent a0adda9c7a
commit fa1d32382b

View file

@ -67,8 +67,11 @@ module IntegrationHelper
false
end
def open(url)
super("http://127.0.0.1:#{port}#{url}")
end
def get(url)
url = "http://127.0.0.1:#{port}#{url}"
open(url).read
end
@ -126,6 +129,7 @@ module IntegrationHelper
def self.extend_object(obj)
super
base_port = 5000 + Process.pid % 100
Sinatra::Base.server.each_with_index do |server, index|
Server.run(server, 5000+index)
end