aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/xml_serialization_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/xml_serialization_test.rb')
-rw-r--r--activerecord/test/xml_serialization_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/xml_serialization_test.rb b/activerecord/test/xml_serialization_test.rb
index 752a0021a9..b32a55a786 100644
--- a/activerecord/test/xml_serialization_test.rb
+++ b/activerecord/test/xml_serialization_test.rb
@@ -133,7 +133,8 @@ end
class DatabaseConnectedXmlSerializationTest < Test::Unit::TestCase
fixtures :authors, :posts
# to_xml used to mess with the hash the user provided which
- # caused the builder to be reused
+ # caused the builder to be reused. This meant the document kept
+ # getting appended to.
def test_passing_hash_shouldnt_reuse_builder
options = {:include=>:posts}
david = authors(:david)
@@ -141,4 +142,10 @@ class DatabaseConnectedXmlSerializationTest < Test::Unit::TestCase
second_xml_size = david.to_xml(options).size
assert_equal first_xml_size, second_xml_size
end
+
+
+ def test_include_uses_association_name
+ xml = authors(:david).to_xml :include=>:hello_posts, :indent=>0
+ assert(xml.include?(%(<hello_posts><post>)) || xml.include?(%(</post></hello-posts>)))
+ end
end \ No newline at end of file