Created
August 30, 2009 20:17
-
-
Save apeckham/178110 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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