Created
October 6, 2017 10:21
-
-
Save otzy007/5eee138d62cd302941732589a812e3ad to your computer and use it in GitHub Desktop.
async cucumber retry
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
module AsyncSupport | |
def eventually(timeout = 10) | |
polling_interval = 0.1 | |
time_limit = Time.now + timeout | |
loop do | |
begin | |
yield | |
rescue Exception => error | |
end | |
return if error.nil? | |
raise error if Time.now >= time_limit | |
sleep polling_interval | |
end | |
end | |
end | |
World(AsyncSupport) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment