Skip to content

Commit dcfe8ae

Browse files
author
Jerry Cheung
committed
test doesn't like @LDAP ivar
1 parent 903e459 commit dcfe8ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/test_ldap.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def setup
66
flexmock(Net::LDAP::Connection).should_receive(:new).and_return(@connection)
77

88
@service = MockInstrumentationService.new
9-
@ldap = Net::LDAP.new \
9+
@subject = Net::LDAP.new \
1010
:server => "test.mocked.com", :port => 636,
1111
:force_no_page => true, # so server capabilities are not queried
1212
:instrumentation_service => @service
@@ -16,9 +16,9 @@ def test_instrument_bind
1616
events = @service.subscribe "bind.net_ldap"
1717

1818
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)
2020

21-
assert @ldap.bind
21+
assert @subject.bind
2222

2323
payload, result = events.pop
2424
assert result
@@ -28,12 +28,12 @@ def test_instrument_bind
2828
def test_instrument_search
2929
events = @service.subscribe "search.net_ldap"
3030

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).
3333
yields(entry = Net::LDAP::Entry.new("uid=user1,ou=users,dc=example,dc=com")).
3434
and_return(flexmock(:search_result, :success? => true, :result_code => 0))
3535

36-
refute_nil @ldap.search(:filter => "(uid=user1)")
36+
refute_nil @subject.search(:filter => "(uid=user1)")
3737

3838
payload, result = events.pop
3939
assert_equal [entry], result

0 commit comments

Comments
 (0)