Created
March 5, 2015 17:55
-
-
Save cblavier/5e15791387a6e22b98d8 to your computer and use it in GitHub Desktop.
TimeHelper
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
defmodule TimeHelper do | |
def wait_until(fun), do: wait_until(500, fun) | |
def wait_until(0, fun), do: fun.() | |
def wait_until(timeout, fun) defo | |
try do | |
fun.() | |
rescue | |
ExUnit.AssertionError -> | |
:timer.sleep(10) | |
wait_until(max(0, timeout - 10), fun) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment