diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-23 10:58:19 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-23 14:29:04 -0800 |
commit | 5badf60d128cb958fa7a0e3f140517b71b88c7ac (patch) | |
tree | 47571d982e0e1239b6344ebb066590732e8d371d /activerecord/test | |
parent | ca7b0a0d1a424aec0973fe22c299b8f04e309784 (diff) | |
download | rails-5badf60d128cb958fa7a0e3f140517b71b88c7ac.tar.gz rails-5badf60d128cb958fa7a0e3f140517b71b88c7ac.tar.bz2 rails-5badf60d128cb958fa7a0e3f140517b71b88c7ac.zip |
dup keeps changes
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/duplication_test.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/activerecord/test/cases/duplication_test.rb b/activerecord/test/cases/duplication_test.rb index 610894a03e..f9d614230b 100644 --- a/activerecord/test/cases/duplication_test.rb +++ b/activerecord/test/cases/duplication_test.rb @@ -6,7 +6,7 @@ module ActiveRecord fixtures :topics def test_dup - assert !Minimalistic.new.freeze.dup.frozen? + assert !Topic.new.freeze.dup.frozen? end def test_dup_not_persisted @@ -26,6 +26,7 @@ module ActiveRecord def test_clone_persisted topic = Topic.first cloned = topic.clone + assert topic.persisted?, 'topic persisted' assert cloned.persisted?, 'topic persisted' assert !cloned.new_record?, 'topic is not new' end @@ -37,7 +38,21 @@ module ActiveRecord cloned = topic.clone assert cloned.persisted?, 'topic persisted' assert !cloned.new_record?, 'topic is not new' - assert cloned.frozen?, 'topic is frozen' + assert cloned.frozen?, 'topic should be frozen' + end + + def test_dup_with_modified_attributes + topic = Topic.first + topic.author_name = 'Aaron' + duped = topic.dup + assert_equal 'Aaron', duped.author_name + end + + def test_dup_with_changes + topic = Topic.first + topic.author_name = 'Aaron' + duped = topic.dup + assert_equal topic.changes, duped.changes end end end |