Function to retry rspec test w/ sleep
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(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