Skip to content

Commit 74fe070

Browse files
committed
Test Net::LDAP#open behavior
1 parent cf39451 commit 74fe070

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/integration/test_open.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require_relative '../test_helper'
2+
3+
class TestBindIntegration < LDAPIntegrationTestCase
4+
def test_binds_without_open
5+
events = @service.subscribe "bind.net_ldap_connection"
6+
7+
@ldap.search(filter: "uid=user1", base: "ou=People,dc=rubyldap,dc=com", ignore_server_caps: true)
8+
@ldap.search(filter: "uid=user1", base: "ou=People,dc=rubyldap,dc=com", ignore_server_caps: true)
9+
10+
assert_equal 2, events.size
11+
end
12+
13+
def test_binds_with_open
14+
events = @service.subscribe "bind.net_ldap_connection"
15+
16+
@ldap.open do
17+
@ldap.search(filter: "uid=user1", base: "ou=People,dc=rubyldap,dc=com", ignore_server_caps: true)
18+
@ldap.search(filter: "uid=user1", base: "ou=People,dc=rubyldap,dc=com", ignore_server_caps: true)
19+
end
20+
21+
assert_equal 1, events.size
22+
end
23+
end

0 commit comments

Comments
 (0)