aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dirty_test.rb
diff options
context:
space:
mode:
authorFederico Brubacher <fbrubacher@gmail.com>2010-05-16 07:24:41 -0300
committerJosé Valim <jose.valim@gmail.com>2010-05-16 23:04:40 +0200
commit6b4e0cc526f55b5532cf99292c94f0a4db53b16f (patch)
tree3a01741b220863bcd701f0b00e6ce0145cb33f06 /activerecord/test/cases/dirty_test.rb
parentade756fe42423033bae8e5aea8f58782f7a6c517 (diff)
downloadrails-6b4e0cc526f55b5532cf99292c94f0a4db53b16f.tar.gz
rails-6b4e0cc526f55b5532cf99292c94f0a4db53b16f.tar.bz2
rails-6b4e0cc526f55b5532cf99292c94f0a4db53b16f.zip
a cloned object no longer mimics changed flags from creator , plus a test case [#4614 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r--activerecord/test/cases/dirty_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index 7a17ef1ee0..3ea2948f62 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -338,6 +338,15 @@ class DirtyTest < ActiveRecord::TestCase
assert !pirate.changed?
end
+ def test_cloned_objects_should_not_copy_dirty_flag_from_creator
+ pirate = Pirate.create!(:catchphrase => "shiver me timbers")
+ pirate_clone = pirate.clone
+ pirate_clone.reset_catchphrase!
+ pirate.catchphrase = "I love Rum"
+ assert pirate.catchphrase_changed?
+ assert !pirate_clone.catchphrase_changed?
+ end
+
def test_reverted_changes_are_not_dirty
phrase = "shiver me timbers"
pirate = Pirate.create!(:catchphrase => phrase)