X11Dependency objects: fix hash equality

This commit is contained in:
Jack Nagel 2014-07-01 21:26:41 -05:00
parent fc2d403a82
commit fe3e802c50
2 changed files with 11 additions and 0 deletions

View File

@ -34,4 +34,8 @@ class X11Dependency < Requirement
return unless X11Dependency === other
min_version <=> other.min_version
end
def eql?(other)
super && min_version == other.min_version
end
end

View File

@ -19,6 +19,13 @@ class X11DependencyTests < Homebrew::TestCase
assert !y.eql?(x)
end
def test_different_min_version
x = X11Dependency.new
y = X11Dependency.new("x11", %w[2.5])
refute x.eql?(y)
refute y.eql?(x)
end
def test_x_env
x = X11Dependency.new
x.stubs(:satisfied?).returns(true)