提交 6079ec1f 编写于 作者: R Rasik Pandey 提交者: Pratik Naik

ActiveResource#eqls? and == should not take into account object identity and...

ActiveResource#eqls? and == should not take into account object identity and prefix options should be considered. [#1098 state:resolved]
Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
上级 9a8e2a05
......@@ -746,8 +746,8 @@ def to_param
# # => true
#
def ==(other)
other.equal?(self) || (other.instance_of?(self.class) && !other.new? && other.id == id)
end
other.equal?(self) || (other.instance_of?(self.class) && other.id == id && other.prefix_options == prefix_options)
end
# Tests for equality (delegates to ==).
def eql?(other)
......
......@@ -40,4 +40,13 @@ def test_hash_should_be_id_hash
assert_equal resource.id.hash, resource.hash
end
end
def test_with_prefix_options
assert_equal @one == @one, @one.eql?(@one)
assert_equal @one == @one.dup, @one.eql?(@one.dup)
new_one = @one.dup
new_one.prefix_options = {:foo => 'bar'}
assert_not_equal @one, new_one
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册