From 2e9af3638d950ef840e1287f99e323887ec6a4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 29 Apr 2010 12:27:25 +0200 Subject: Move several configuration values from Hash to ActiveSupport::XmlMini, which both Hash and Array depends on. Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array. --- activerecord/test/cases/xml_serialization_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/test/cases/xml_serialization_test.rb') diff --git a/activerecord/test/cases/xml_serialization_test.rb b/activerecord/test/cases/xml_serialization_test.rb index b1c75ec8cd..bd29ae2612 100644 --- a/activerecord/test/cases/xml_serialization_test.rb +++ b/activerecord/test/cases/xml_serialization_test.rb @@ -79,8 +79,8 @@ class DefaultXmlSerializationTest < ActiveRecord::TestCase assert_match %r{false}, @xml end - def test_should_serialize_yaml - assert_match %r{---\s?\n:gem: ruby\n}, @xml + def test_should_serialize_hash + assert_match %r{\s*ruby\s*}m, @xml end end -- cgit v1.2.3 From 883f27aa9a6fae5194400bb8f00e343dcb610270 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Thu, 29 Apr 2010 17:39:05 -0400 Subject: test cases for record.to_xml [#458 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/test/cases/xml_serialization_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases/xml_serialization_test.rb') diff --git a/activerecord/test/cases/xml_serialization_test.rb b/activerecord/test/cases/xml_serialization_test.rb index bd29ae2612..751946ffc5 100644 --- a/activerecord/test/cases/xml_serialization_test.rb +++ b/activerecord/test/cases/xml_serialization_test.rb @@ -234,4 +234,12 @@ class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase assert types.include?('StiPost') end + def test_should_produce_xml_for_methods_returning_array + xml = authors(:david).to_xml(:methods => :social) + array = Hash.from_xml(xml)['author']['social'] + assert_equal 2, array.size + assert array.include? 'twitter' + assert array.include? 'github' + end + end -- cgit v1.2.3