aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/array_ext_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-08 02:56:25 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-08 02:56:25 +0000
commitcd989472a5248aae4f827c35347bdb871de1822a (patch)
tree13cad5fa4cd877788747930fe6076fcd01085a0f /activesupport/test/core_ext/array_ext_test.rb
parent24fca9d92ea9bef676f74259996c4039e014dfe2 (diff)
downloadrails-cd989472a5248aae4f827c35347bdb871de1822a.tar.gz
rails-cd989472a5248aae4f827c35347bdb871de1822a.tar.bz2
rails-cd989472a5248aae4f827c35347bdb871de1822a.zip
Added Hash#to_xml and Array#to_xml that makes it much easier to produce XML from basic structures [DHH] Moved Jim Weirich's wonderful Builder from Action Pack to Active Support (it's simply too useful to be stuck in AP) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3812 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/array_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb
index 266b5eefab..e13c57d262 100644
--- a/activesupport/test/core_ext/array_ext_test.rb
+++ b/activesupport/test/core_ext/array_ext_test.rb
@@ -67,5 +67,14 @@ class ArrayExtGroupingTests < Test::Unit::TestCase
assert_equal [%w(a b c), %w(d e f), ['g', false, false]], groups
end
-
end
+
+class ArraToXmlTests < Test::Unit::TestCase
+ def test_to_xml
+ a = [ { :name => "David", :street_address => "Paulina" }, { :name => "Jason", :street_address => "Evergreen" } ]
+ assert_equal(
+ "<hashes><hash><street-address type=\"string\">Paulina</street-address><name type=\"string\">David</name></hash><hash><street-address type=\"string\">Evergreen</street-address><name type=\"string\">Jason</name></hash></hashes>",
+ a.to_xml
+ )
+ end
+end \ No newline at end of file