我不確定如何通過以下測試用例。我用源聯合(|)和內部list.include(源)我如何覆蓋與無字段紅寶石平等?
class Source
# mongoid object code...
def hash
url.hash
end
def ==(other)
eql?(other)
end
def eql?(other_source)
url = self.url and other_source and url == other_source.url
end
end
測試用例:
ext1 = Source.new
ext2 = Source.new(url: "test")
(ext2.== ext1).should == false # false
(ext1.== ext2).should == false # is returning nil instead of false
我想有最後的情況下返回false,而不是零,但我不知道?如何發生這種事情?