From 6a8f1b8b402b31ae43872c9d1f37b931c85799e7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 23 Nov 2010 11:13:24 -0800 Subject: renaming duplication test to dup test --- activerecord/test/cases/dup_test.rb | 61 +++++++++++++++++++++++++++++ activerecord/test/cases/duplication_test.rb | 61 ----------------------------- 2 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 activerecord/test/cases/dup_test.rb delete mode 100644 activerecord/test/cases/duplication_test.rb (limited to 'activerecord/test') diff --git a/activerecord/test/cases/dup_test.rb b/activerecord/test/cases/dup_test.rb new file mode 100644 index 0000000000..fa528c4936 --- /dev/null +++ b/activerecord/test/cases/dup_test.rb @@ -0,0 +1,61 @@ +require "cases/helper" +require 'models/topic' + +module ActiveRecord + class DupTest < ActiveRecord::TestCase + fixtures :topics + + def test_dup + assert !Topic.new.freeze.dup.frozen? + end + + def test_dup_not_persisted + topic = Topic.first + duped = topic.dup + + assert !duped.persisted?, 'topic not persisted' + assert duped.new_record?, 'topic is new' + end + + def test_dup_has_no_id + topic = Topic.first + duped = topic.dup + assert_nil duped.id + 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 + + def test_dup_topics_are_independent + topic = Topic.first + topic.author_name = 'Aaron' + duped = topic.dup + + duped.author_name = 'meow' + + assert_not_equal topic.changes, duped.changes + end + + def test_dup_attributes_are_independent + topic = Topic.first + duped = topic.dup + + duped.author_name = 'meow' + topic.author_name = 'Aaron' + + assert_equal 'Aaron', topic.author_name + assert_equal 'meow', duped.author_name + end + end +end diff --git a/activerecord/test/cases/duplication_test.rb b/activerecord/test/cases/duplication_test.rb deleted file mode 100644 index ecea843bbf..0000000000 --- a/activerecord/test/cases/duplication_test.rb +++ /dev/null @@ -1,61 +0,0 @@ -require "cases/helper" -require 'models/topic' - -module ActiveRecord - class DuplicationTest < ActiveRecord::TestCase - fixtures :topics - - def test_dup - assert !Topic.new.freeze.dup.frozen? - end - - def test_dup_not_persisted - topic = Topic.first - duped = topic.dup - - assert !duped.persisted?, 'topic not persisted' - assert duped.new_record?, 'topic is new' - end - - def test_dup_has_no_id - topic = Topic.first - duped = topic.dup - assert_nil duped.id - 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 - - def test_dup_topics_are_independent - topic = Topic.first - topic.author_name = 'Aaron' - duped = topic.dup - - duped.author_name = 'meow' - - assert_not_equal topic.changes, duped.changes - end - - def test_dup_attributes_are_independent - topic = Topic.first - duped = topic.dup - - duped.author_name = 'meow' - topic.author_name = 'Aaron' - - assert_equal 'Aaron', topic.author_name - assert_equal 'meow', duped.author_name - end - end -end -- cgit v1.2.3