From 0297b31b8235ee5c64743fdd4f922b008dd83af0 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 3 Dec 2006 16:47:53 +0000 Subject: Fixed Array#to_xml when it contains a series of hashes (each piece would get its own XML declaration) (closes #6610) [thkarcher/cyu] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5668 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/array_ext_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 957c56c92d..709df84f06 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -169,4 +169,14 @@ class ArrayToXmlTests < Test::Unit::TestCase assert xml.include?(%(Paulina)) assert xml.include?(%(Evergreen)) end + + def test_to_with_instruct + xml = [ + { :name => "David", :age => 26, :age_in_millis => 820497600000 }, + { :name => "Jason", :age => 31, :age_in_millis => BigDecimal.new('1.0') } + ].to_xml(:skip_instruct => false, :indent => 0) + + assert /^<\?xml [^>]*/.match(xml) + assert xml.rindex(/<\?xml /) == 0 + end end -- cgit v1.2.3