diff --git a/lib/net/ldap/entry.rb b/lib/net/ldap/entry.rb index 8eaf4f18..8e71b389 100644 --- a/lib/net/ldap/entry.rb +++ b/lib/net/ldap/entry.rb @@ -196,4 +196,8 @@ def setter?(sym) sym.to_s[-1] == ?= end private :setter? + + def ==(other) + other.instance_of?(self.class) && @myhash == other.to_h + end end # class Entry diff --git a/test/test_entry.rb b/test/test_entry.rb index 7c440ddf..60c89ba6 100644 --- a/test/test_entry.rb +++ b/test/test_entry.rb @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy