diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 06:20:07 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 06:20:07 +0000 |
commit | 652fe645f6a199417f672965b1f4d4078d046f7d (patch) | |
tree | a8ab52f73cea5aff75b85abfc67b80f00d3c5f59 /activesupport/test | |
parent | 40860e9852d08837197b5a96a48b4439cbc86852 (diff) | |
download | rails-652fe645f6a199417f672965b1f4d4078d046f7d.tar.gz rails-652fe645f6a199417f672965b1f4d4078d046f7d.tar.bz2 rails-652fe645f6a199417f672965b1f4d4078d046f7d.zip |
Array#to_xml yields the builder just like Hash and ActiveRecord::Base. Closes #8472.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6858 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 26bc232b81..e5ca4c424f 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -179,4 +179,15 @@ class ArrayToXmlTests < Test::Unit::TestCase assert_match(/^<\?xml [^>]*/, xml) assert_equal 0, xml.rindex(/<\?xml /) end + + def test_to_xml_with_block + xml = [ + { :name => "David", :age => 26, :age_in_millis => 820497600000 }, + { :name => "Jason", :age => 31, :age_in_millis => BigDecimal.new('1.0') } + ].to_xml(:skip_instruct => true, :indent => 0) do |xml| + xml.count 2 + end + + assert xml.include?(%(<count>2</count>)), xml + end end |