Skip to content

Commit 08dad42

Browse files
committed
Minor 💅 for Net::LDAP instrumentation specs
1 parent 2b0be68 commit 08dad42

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

spec/unit/ldap_spec.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22

33
describe Net::LDAP do
44
describe "initialize" do
5-
context "on instrumentation_service configuration" do
5+
context "when instrumentation is configured" do
66
before do
77
@tcp_socket = flexmock(:connection)
88
@tcp_socket.should_receive(:close)
99
flexmock(TCPSocket).should_receive(:new).and_return(@tcp_socket)
1010
@service = MockInstrumentationService.new
1111
end
1212

13-
it "should set the service object and instrument network calls" do
14-
ldap = Net::LDAP.new(:server => 'test.mocked.com', :port => 636,
15-
:instrumentation_service => @service)
13+
subject do
14+
Net::LDAP.new \
15+
:server => "test.mocked.com", :port => 636,
16+
:instrumentation_service => @service
17+
end
1618

19+
it "should set the service object and instrument network calls" do
1720
@tcp_socket.should_receive(:write).and_return(bytes_written = 1)
1821

1922
write_events = @service.subscribe "write.net_ldap_connection"
@@ -24,7 +27,7 @@
2427
read_result = [2, ber]
2528
@tcp_socket.should_receive(:read_ber).and_return(read_result)
2629

27-
ldap.bind.should be_true
30+
subject.bind.should be_true
2831

2932
# a write event
3033
payload, result = write_events.pop

0 commit comments

Comments
 (0)