From 9dfc5e39e8f6898588df6c31823c0deb3b0c7f80 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 12 Nov 2014 17:35:16 -0600 Subject: Fix Requirement equality --- Library/Homebrew/requirement.rb | 3 ++- Library/Homebrew/test/test_requirement.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Library') 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 -- cgit v1.2.3