aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/requirement.rb3
-rw-r--r--Library/Homebrew/test/test_requirement.rb2
2 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb
index 517c9c92a..19ea21f1a 100644
--- a/Library/Homebrew/requirement.rb
+++ b/Library/Homebrew/requirement.rb
@@ -75,9 +75,10 @@ class Requirement
self.class.env_proc
end
- def eql?(other)
+ def ==(other)
instance_of?(other.class) && name == other.name && tags == other.tags
end
+ alias_method :eql?, :==
def hash
name.hash ^ tags.hash
diff --git a/Library/Homebrew/test/test_requirement.rb b/Library/Homebrew/test/test_requirement.rb
index a3fd117eb..a4400feb3 100644
--- a/Library/Homebrew/test/test_requirement.rb
+++ b/Library/Homebrew/test/test_requirement.rb
@@ -129,12 +129,14 @@ class RequirementTests < Homebrew::TestCase
def test_eql
a, b = Requirement.new, Requirement.new
+ assert_equal a, b
assert_eql a, b
assert_equal a.hash, b.hash
end
def test_not_eql
a, b = Requirement.new([:optional]), Requirement.new
+ refute_equal a, b
refute_eql a, b
refute_equal a.hash, b.hash
end