Skip to content

Commit 49d2538

Browse files
Refactor of stub helper and ucpath specs
1 parent 83ad8b6 commit 49d2538

File tree

3 files changed

+207
-336
lines changed

3 files changed

+207
-336
lines changed

spec/ldap_helper.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,16 @@ def stub_ldap(id)
3434

3535
ldap_rec
3636
end
37+
38+
def stub_ldap_entries(ldap_id, entries)
39+
ldap_stub = stub_ldap(ldap_id)
40+
ldap_conn = ldap_stub['connection']
41+
42+
allow(Net::LDAP).to receive(:new).with(ldap_stub['params']).and_return(ldap_conn)
43+
expect(ldap_conn).to receive(:bind)
44+
expect(ldap_conn).to receive(:search).with(ldap_stub['base']) do |_, &block|
45+
entries.each { |entry| block.call(entry) }
46+
end
47+
48+
ldap_stub
49+
end

0 commit comments

Comments
 (0)