From c87d242bf7b0f75800926c3a8cf23bb43667c9dd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 19 Apr 2007 22:32:39 +0000 Subject: Added yielding of builder in Hash#to_xml [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6540 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/hash_ext_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 63caed7d99..813e23af5f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -342,6 +342,17 @@ class HashToXmlTest < Test::Unit::TestCase assert xml.include?(%()) end + def test_one_level_with_yielding + xml = { :name => "David", :street => "Paulina" }.to_xml(@xml_options) do |xml| + xml.creator("Rails") + end + + assert_equal "", xml.first(8) + assert xml.include?(%(Paulina)) + assert xml.include?(%(David)) + assert xml.include?(%(Rails)) + end + def test_two_levels xml = { :name => "David", :address => { :street => "Paulina" } }.to_xml(@xml_options) assert_equal "", xml.first(8) -- cgit v1.2.3