Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created August 30, 2009 20:17
Show Gist options
  • Save apeckham/178110 to your computer and use it in GitHub Desktop.
Save apeckham/178110 to your computer and use it in GitHub Desktop.
def wait_for_server
time_out_at = Time.now + 30.seconds
loop do
raise "Server didn't start after 30 seconds" if Time.now > time_out_at
begin
open 'http://localhost:2000/'
return
rescue Errno::ECONNREFUSED, Errno::ECONNRESET
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment