Permalink
Browse files

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.
  • Loading branch information...
1 parent c1c6f51 commit dbacebafac45db1369396a5702f5435b863d3278 @carlosantoniodasilva carlosantoniodasilva committed May 2, 2014
Showing with 10 additions and 9 deletions.
  1. +8 −0 activerecord/test/cases/dup_test.rb
  2. +2 −9 activerecord/test/cases/persistence_test.rb
@@ -32,6 +32,14 @@ def test_dup_not_persisted
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 @@ def test_save_for_record_with_only_primary_key_that_is_provided
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

0 comments on commit dbaceba

Please sign in to comment.