mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Move dup destroyed test to specific file that tests dup logic
Also change other related test to use existing record rather than creating new one.
This commit is contained in:
parent
c1c6f514f4
commit
dbacebafac
2 changed files with 10 additions and 9 deletions
|
@ -32,6 +32,14 @@ module ActiveRecord
|
|||
assert duped.new_record?, 'topic is new'
|
||||
end
|
||||
|
||||
def test_dup_not_destroyed
|
||||
topic = Topic.first
|
||||
topic.destroy
|
||||
|
||||
duped = topic.dup
|
||||
assert_not duped.destroyed?
|
||||
end
|
||||
|
||||
def test_dup_has_no_id
|
||||
topic = Topic.first
|
||||
duped = topic.dup
|
||||
|
|
|
@ -234,19 +234,12 @@ class PersistenceTest < ActiveRecord::TestCase
|
|||
end
|
||||
|
||||
def test_save_with_duping_of_destroyed_object
|
||||
developer = Developer.create(name: "Kuldeep")
|
||||
developer = Developer.first
|
||||
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
|
||||
assert_not new_developer.destroyed?
|
||||
end
|
||||
|
||||
def test_create_many
|
||||
|
|
Loading…
Reference in a new issue