diff options
| author | Jack Nagel | 2014-11-12 17:35:16 -0600 |
|---|---|---|
| committer | Jack Nagel | 2014-11-12 17:35:16 -0600 |
| commit | 9dfc5e39e8f6898588df6c31823c0deb3b0c7f80 (patch) | |
| tree | 35d951aaf3a841b8235485fe8a46d33699cacff6 /Library | |
| parent | 33dfc8e8b8cc98abf6d3f1dfe1fd982465d44e94 (diff) | |
| download | brew-9dfc5e39e8f6898588df6c31823c0deb3b0c7f80.tar.bz2 | |
Fix Requirement equality
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/requirement.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_requirement.rb | 2 |
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 |
