Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/net/ldap/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,8 @@ def setter?(sym)
sym.to_s[-1] == ?=
end
private :setter?

def ==(other)
return other.instance_of?(self.class) && @myhash == other.to_h
end
end # class Entry
11 changes: 11 additions & 0 deletions test/test_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ def test_to_h
duplicate.delete(:sn)
assert_not_equal duplicate, @entry.to_h
end

def test_equal_operator
entry_two = Net::LDAP::Entry.new 'cn=Barbara,o=corp'
assert_equal @entry, entry_two

@entry['sn'] = 'Jensen'
assert_not_equal @entry, entry_two

entry_two['sn'] = 'Jensen'
assert_equal @entry, entry_two
end
end

class TestEntryLDIF < Test::Unit::TestCase
Expand Down