Skip to content

Commit

Permalink
Fix Requirement equality
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Nov 12, 2014
1 parent 39cd941 commit 8b414a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Library/Homebrew/requirement.rb
Expand Up @@ -75,9 +75,10 @@ def env_proc
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
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/test/test_requirement.rb
Expand Up @@ -129,12 +129,14 @@ def test_modify_build_environment_without_env_proc

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
Expand Down

0 comments on commit 8b414a2

Please sign in to comment.