aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 33ea40e91a..18c5b50006 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -807,7 +807,7 @@ class BasicsTest < Test::Unit::TestCase
cloned_topic = nil
assert_nothing_raised { cloned_topic = topic.clone }
assert_equal topic.title, cloned_topic.title
- assert cloned_topic.new?
+ assert cloned_topic.new_record?
# test if the attributes have been cloned
topic.title = "a"
@@ -822,7 +822,7 @@ class BasicsTest < Test::Unit::TestCase
assert_equal "b", topic.title["a"]
cloned_topic.save
- assert !cloned_topic.new?
+ assert !cloned_topic.new_record?
assert cloned_topic.id != topic.id
end
@@ -834,7 +834,7 @@ class BasicsTest < Test::Unit::TestCase
assert_nothing_raised { clone = dev.clone }
assert_kind_of DeveloperSalary, clone.salary
assert_equal dev.salary.amount, clone.salary.amount
- assert clone.new?
+ assert clone.new_record?
# test if the attributes have been cloned
original_amount = clone.salary.amount
@@ -842,7 +842,7 @@ class BasicsTest < Test::Unit::TestCase
assert_equal original_amount, clone.salary.amount
assert clone.save
- assert !clone.new?
+ assert !clone.new_record?
assert clone.id != dev.id
end
@@ -1340,6 +1340,12 @@ class BasicsTest < Test::Unit::TestCase
xml = [ topics(:first), topics(:second) ].to_xml(:indent => 0, :skip_instruct => true, :include => :replies)
assert xml.include?(%(<replies><reply>))
end
+
+ def test_array_to_xml_including_methods
+ xml = [ topics(:first), topics(:second) ].to_xml(:indent => 0, :skip_instruct => true, :methods => [ :topic_id ])
+ assert xml.include?(%(<topic-id type="integer">#{topics(:first).topic_id}</topic-id>))
+ assert xml.include?(%(<topic-id type="integer">#{topics(:second).topic_id}</topic-id>))
+ end
def test_array_to_xml_including_has_one_association
xml = [ companies(:first_firm), companies(:rails_core) ].to_xml(:indent => 0, :skip_instruct => true, :include => :account)