diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-04-18 20:38:38 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-04-18 20:38:38 +0200 |
commit | 99352088ca9629147150627b2702684f9bf1e608 (patch) | |
tree | 6b9501cd4fed638a55a4dd4ec87886dc8bfe8383 /activerecord/test/cases/persistence_test.rb | |
parent | 98e8c96d42052dd74310aa95102c55f3762becce (diff) | |
parent | 5fe4e62807adc61c42c2d94ec36802f25554224a (diff) | |
download | rails-99352088ca9629147150627b2702684f9bf1e608.tar.gz rails-99352088ca9629147150627b2702684f9bf1e608.tar.bz2 rails-99352088ca9629147150627b2702684f9bf1e608.zip |
Merge pull request #14796 from kuldeepaggarwal/fix-save-issue
when a destroyed record is duped, it is no longer ´destroyed?`.
Diffstat (limited to 'activerecord/test/cases/persistence_test.rb')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 046fe83e54..9209672ac5 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -233,6 +233,22 @@ class PersistenceTest < ActiveRecord::TestCase assert_nothing_raised { Minimalistic.create!(:id => 2) } end + def test_save_with_duping_of_destroyed_object + developer = Developer.create(name: "Kuldeep") + developer.destroy + new_developer = developer.dup + new_developer.save + assert new_developer.persisted? + end + + def test_dup_of_destroyed_object_is_not_destroyed + developer = Developer.create(name: "Kuldeep") + developer.destroy + new_developer = developer.dup + new_developer.save + assert_equal new_developer.destroyed?, false + end + def test_create_many topics = Topic.create([ { "title" => "first" }, { "title" => "second" }]) assert_equal 2, topics.size |