From 79212def83c0c4fb6299f019988963212fe6664c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 25 May 2007 23:04:45 +0000 Subject: Test that #to_xml takes a block. Closes #8471. [seth] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 02ca84e782..50e7ba9da3 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1598,6 +1598,15 @@ class BasicsTest < Test::Unit::TestCase assert xml.include?(%(I am Jack's profound disappointment)) end + def test_to_xml_with_block + value = "Rockin' the block" + xml = Company.new.to_xml(:skip_instruct => true) do |xml| + xml.tag! "arbitrary-element", value + end + assert_equal "", xml.first(9) + assert xml.include?(%(#{value})) + end + def test_except_attributes assert_equal( %w( author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read), -- cgit v1.2.3