Skip to content

Instantly share code, notes, and snippets.

@slashdotdash
Last active April 11, 2024 14:01
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 slashdotdash/82d851f44d0b86815f04eab4391dfd54 to your computer and use it in GitHub Desktop.
Save slashdotdash/82d851f44d0b86815f04eab4391dfd54 to your computer and use it in GitHub Desktop.
ExUnit wait until helper function
def wait_until(timeout \\ 1_000, fun)
def wait_until(0, fun), do: fun.()
def wait_until(timeout, fun) do
fun.()
rescue
ExUnit.AssertionError ->
:timer.sleep(10)
timeout = max(0, timeout - 10)
wait_until(timeout, fun)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment