summaryrefslogtreecommitdiff
path: root/test/elixir/test/helper_test.exs
blob: 1e498a15c30d0397a52e6c65b8af095f68d14b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
defmodule HelperTest do
  use CouchTestCase

  @moduledoc """
  Test helper code
  """

  @moduletag :helper
  @moduletag kind: :single_node

  test "retry_until handles boolean conditions", _context do
    retry_until(fn ->
      true
    end)
  end

  test "retry_until handles assertions", _context do
    retry_until(fn ->
      assert true
    end)
  end

  test "retry_until times out", _context do
    assert_raise RuntimeError, ~r/^timed out after \d+ ms$/, fn ->
      retry_until(
        fn ->
          assert false
        end,
        1,
        5
      )
    end
  end
end