@@ -6,7 +6,7 @@ def setup
6
6
flexmock ( Net ::LDAP ::Connection ) . should_receive ( :new ) . and_return ( @connection )
7
7
8
8
@service = MockInstrumentationService . new
9
- @ldap = Net ::LDAP . new \
9
+ @subject = Net ::LDAP . new \
10
10
:server => "test.mocked.com" , :port => 636 ,
11
11
:force_no_page => true , # so server capabilities are not queried
12
12
:instrumentation_service => @service
@@ -16,9 +16,9 @@ def test_instrument_bind
16
16
events = @service . subscribe "bind.net_ldap"
17
17
18
18
bind_result = flexmock ( :bind_result , :success? => true )
19
- @connection . should_receive ( :bind ) . with ( Hash ) . and_return ( bind_result )
19
+ flexmock ( @connection ) . should_receive ( :bind ) . with ( Hash ) . and_return ( bind_result )
20
20
21
- assert @ldap . bind
21
+ assert @subject . bind
22
22
23
23
payload , result = events . pop
24
24
assert result
@@ -28,12 +28,12 @@ def test_instrument_bind
28
28
def test_instrument_search
29
29
events = @service . subscribe "search.net_ldap"
30
30
31
- @connection . should_receive ( :bind ) . and_return ( flexmock ( :bind_result , :result_code => 0 ) )
32
- @connection . should_receive ( :search ) . with ( Hash , Proc ) .
31
+ flexmock ( @connection ) . should_receive ( :bind ) . and_return ( flexmock ( :bind_result , :result_code => 0 ) )
32
+ flexmock ( @connection ) . should_receive ( :search ) . with ( Hash , Proc ) .
33
33
yields ( entry = Net ::LDAP ::Entry . new ( "uid=user1,ou=users,dc=example,dc=com" ) ) .
34
34
and_return ( flexmock ( :search_result , :success? => true , :result_code => 0 ) )
35
35
36
- refute_nil @ldap . search ( :filter => "(uid=user1)" )
36
+ refute_nil @subject . search ( :filter => "(uid=user1)" )
37
37
38
38
payload , result = events . pop
39
39
assert_equal [ entry ] , result
0 commit comments