Skip to content

Instantly share code, notes, and snippets.

@mmzyk
Created March 2, 2012 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmzyk/1958902 to your computer and use it in GitHub Desktop.
Save mmzyk/1958902 to your computer and use it in GitHub Desktop.
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