@@ -63,21 +63,23 @@ defmodule DBConnectionTest do
63
63
end
64
64
65
65
describe "connection_module/1" do
66
- test "returns the connection module when given a pool pid" do
67
- { :ok , pool } = P . start_link ( [ ] )
66
+ setup do
67
+ { :ok , agent } = A . start_link ( [ { :ok , :state } , { :idle , :state } , { :idle , :state } ] )
68
+ [ agent: agent ]
69
+ end
70
+
71
+ test "returns the connection module when given a pool pid" , % { agent: agent } do
72
+ { :ok , pool } = P . start_link ( agent: agent )
68
73
assert { :ok , TestConnection } = DBConnection . connection_module ( pool )
69
74
end
70
75
71
- test "returns the connection module when given a pool name" , % { test: name } do
72
- { :ok , _pool } = P . start_link ( name: name )
76
+ test "returns the connection module when given a pool name" , % { test: name , agent: agent } do
77
+ { :ok , _pool } = P . start_link ( name: name , agent: agent )
73
78
assert { :ok , TestConnection } = DBConnection . connection_module ( name )
74
79
end
75
80
76
- test "returns the connection module when given a locked connection reference" do
77
- { :ok , agent } = A . start_link ( [ { :ok , :state } , { :idle , :state } , { :idle , :state } ] )
78
-
79
- opts = [ agent: agent ]
80
- { :ok , pool } = P . start_link ( opts )
81
+ test "returns the connection module when given a locked connection reference" , % { agent: agent } do
82
+ { :ok , pool } = P . start_link ( agent: agent )
81
83
82
84
P . run ( pool , fn conn ->
83
85
assert { :ok , TestConnection } = DBConnection . connection_module ( conn )
0 commit comments