aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authormfoster <fosterinfo@gmail.com>2010-01-31 01:03:52 -0800
committerJosé Valim <jose.valim@gmail.com>2010-04-10 18:12:43 +0200
commit5850edf104ab1da0f72a43e6717a1270134db293 (patch)
tree34f6eeca7ace455e57162a2ea2dfc9dd0f0b4169 /activerecord
parentdc974306301809f4e184f518261f5baae2c909eb (diff)
downloadrails-5850edf104ab1da0f72a43e6717a1270134db293.tar.gz
rails-5850edf104ab1da0f72a43e6717a1270134db293.tar.bz2
rails-5850edf104ab1da0f72a43e6717a1270134db293.zip
Made arrays of ActiveRecords, and any classes, with namespaces convert to valid xml. [#3824 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/xml_serialization_test.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/cases/xml_serialization_test.rb b/activerecord/test/cases/xml_serialization_test.rb
index e1ad5c1685..2849ff11b7 100644
--- a/activerecord/test/cases/xml_serialization_test.rb
+++ b/activerecord/test/cases/xml_serialization_test.rb
@@ -130,10 +130,20 @@ class NilXmlSerializationTest < ActiveRecord::TestCase
end
class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase
- fixtures :authors, :posts
+ fixtures :authors, :posts, :projects
+
# to_xml used to mess with the hash the user provided which
# caused the builder to be reused. This meant the document kept
# getting appended to.
+
+ def test_modules
+ projects = MyApplication::Business::Project.all
+ xml = projects.to_xml
+ root = projects.first.class.to_s.underscore.pluralize.tr('/','_').dasherize
+ assert_match "<#{root} type=\"array\">", xml
+ assert_match "</#{root}>", xml
+ end
+
def test_passing_hash_shouldnt_reuse_builder
options = {:include=>:posts}
david = authors(:david)