aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/xml_serialization_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-05-03 02:24:50 +0000
committerMichael Koziarski <michael@koziarski.com>2007-05-03 02:24:50 +0000
commit0c960602fe13a05a787b1cad85d61f8a45b08427 (patch)
tree2c5fb1248123a97dae98fac3973bd741cc5bfb92 /activerecord/test/xml_serialization_test.rb
parentb8e74466cce6216dc89414753bd266a66b643cfb (diff)
downloadrails-0c960602fe13a05a787b1cad85d61f8a45b08427.tar.gz
rails-0c960602fe13a05a787b1cad85d61f8a45b08427.tar.bz2
rails-0c960602fe13a05a787b1cad85d61f8a45b08427.zip
Change Base#to_xml to take the name for a container element for an association from the element name, not the first record's class name. Closes #7004
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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