提交 28f4df09 编写于 作者: A Aaron Patterson

testing duped attributes are independent

上级 4c1f76ea
......@@ -41,6 +41,13 @@ def test_clone_keeps_frozen
assert cloned.frozen?, 'topic should be frozen'
end
def test_clone_is_shallow
topic = Topic.first
cloned = topic.clone
topic.author_name = 'Aaron'
assert_equal 'Aaron', cloned.author_name
end
def test_dup_with_modified_attributes
topic = Topic.first
topic.author_name = 'Aaron'
......@@ -64,5 +71,16 @@ def test_dup_topics_are_independent
assert_not_equal topic.changes, duped.changes
end
def test_dup_attributes_are_independent
topic = Topic.first
duped = topic.dup
duped.author_name = 'meow'
topic.author_name = 'Aaron'
assert_equal 'Aaron', topic.author_name
assert_equal 'meow', duped.author_name
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册