@@ -4,63 +4,72 @@ defmodule RedexServerTest do
4
4
5
5
setup do
6
6
IO . puts "starting server"
7
- { :ok , server } = Redex.Server . start_link ( )
7
+ { :ok , server } = Redex.Server . start_link ( [ ] )
8
8
% { pid: server }
9
9
end
10
10
11
+ setup context do
12
+ Redex.TestUtils . wait_for_server ( )
13
+ context
14
+ end
15
+
11
16
test "it starts" , % { pid: pid } do
12
17
assert Process . alive? ( pid )
13
18
end
19
+
20
+ test "it responds to ping" , % { pid: pid } do
21
+
22
+ end
14
23
end
15
24
16
25
17
- defmodule AssertionTest do
18
- use ExUnit.Case , async: true
26
+ # defmodule AssertionTest do
27
+ # use ExUnit.Case, async: true
19
28
20
- # "setup_all" is called once per module before any test runs
21
- setup_all do
22
- IO . puts "Starting AssertionTest"
29
+ # # "setup_all" is called once per module before any test runs
30
+ # setup_all do
31
+ # IO.puts "Starting AssertionTest"
23
32
24
- # Context is not updated here
25
- :ok
26
- end
33
+ # # Context is not updated here
34
+ # :ok
35
+ # end
27
36
28
- # "setup" is called before each test
29
- setup do
30
- IO . puts "This is a setup callback for #{ inspect self ( ) } "
37
+ # # "setup" is called before each test
38
+ # setup do
39
+ # IO.puts "This is a setup callback for #{inspect self()}"
31
40
32
- on_exit fn ->
33
- IO . puts "This is invoked once the test is done. Process: #{ inspect self ( ) } "
34
- end
41
+ # on_exit fn ->
42
+ # IO.puts "This is invoked once the test is done. Process: #{inspect self()}"
43
+ # end
35
44
36
- # Returns extra metadata to be merged into context
37
- [ hello: "world" ]
45
+ # # Returns extra metadata to be merged into context
46
+ # [hello: "world"]
38
47
39
- # Similarly, any of the following would work:
40
- # {:ok, [hello: "world"]}
41
- # %{hello: "world"}
42
- # {:ok, %{hello: "world"}}
43
- end
48
+ # # Similarly, any of the following would work:
49
+ # # {:ok, [hello: "world"]}
50
+ # # %{hello: "world"}
51
+ # # {:ok, %{hello: "world"}}
52
+ # end
44
53
45
- # Same as above, but receives the context as argument
46
- setup context do
47
- IO . puts "Setting up: #{ context . test } "
48
- :ok
49
- end
54
+ # # Same as above, but receives the context as argument
55
+ # setup context do
56
+ # IO.puts "Setting up: #{context.test}"
57
+ # :ok
58
+ # end
50
59
51
- # Setups can also invoke a local or imported function that returns a context
52
- setup :invoke_local_or_imported_function
60
+ # # Setups can also invoke a local or imported function that returns a context
61
+ # setup :invoke_local_or_imported_function
53
62
54
- test "always pass" do
55
- assert true
56
- end
63
+ # test "always pass" do
64
+ # assert true
65
+ # end
57
66
58
- test "uses metadata from setup" , context do
59
- assert context [ :hello ] == "world"
60
- assert context [ :from_named_setup ] == true
61
- end
67
+ # test "uses metadata from setup", context do
68
+ # assert context[:hello] == "world"
69
+ # assert context[:from_named_setup] == true
70
+ # end
62
71
63
- defp invoke_local_or_imported_function ( context ) do
64
- [ from_named_setup: true ]
65
- end
66
- end
72
+ # defp invoke_local_or_imported_function(context) do
73
+ # [from_named_setup: true]
74
+ # end
75
+ # end
0 commit comments