Skip to content

Instantly share code, notes, and snippets.

@mmzyk
Created March 2, 2012 14:53
Embed
What would you like to do?
Function to retry rspec test w/ sleep
def wait(time, increment = 5, elapsed_time = 0, &block)
begin
yield
rescue Exception => e
if elapsed_time >= time
raise e
else
sleep increment
wait(time, increment, elapsed_time + increment, &block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment