diff options
author | José Valim <jose.valim@gmail.com> | 2010-04-29 12:27:25 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-29 12:42:42 +0200 |
commit | 2e9af3638d950ef840e1287f99e323887ec6a4c4 (patch) | |
tree | eb08bcf15f3096f15ffc705190df649cc208b071 /activerecord/test | |
parent | 1bea5c755c25cd90171477fe725e64b26395b810 (diff) | |
download | rails-2e9af3638d950ef840e1287f99e323887ec6a4c4.tar.gz rails-2e9af3638d950ef840e1287f99e323887ec6a4c4.tar.bz2 rails-2e9af3638d950ef840e1287f99e323887ec6a4c4.zip |
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.
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 5 | ||||
-rw-r--r-- | activerecord/test/cases/xml_serialization_test.rb | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 2f4243a6aa..3623680de9 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -2085,6 +2085,7 @@ class BasicsTest < ActiveRecord::TestCase assert_equal "topic", xml.root.name assert_equal "The First Topic" , xml.elements["//title"].text assert_equal "David" , xml.elements["//author-name"].text + assert_match "Have a nice day", xml.elements["//content"].text assert_equal "1", xml.elements["//id"].text assert_equal "integer" , xml.elements["//id"].attributes['type'] @@ -2095,10 +2096,6 @@ class BasicsTest < ActiveRecord::TestCase assert_equal written_on_in_current_timezone, xml.elements["//written-on"].text assert_equal "datetime" , xml.elements["//written-on"].attributes['type'] - assert_match(/^--- Have a nice day\n/ , xml.elements["//content"].text) - assert_equal 'Have a nice day' , YAML.load(xml.elements["//content"].text) - assert_equal "yaml" , xml.elements["//content"].attributes['type'] - assert_equal "david@loudthinking.com", xml.elements["//author-email-address"].text assert_equal nil, xml.elements["//parent-id"].text 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{<awesome type=\"boolean\">false</awesome>}, @xml end - def test_should_serialize_yaml - assert_match %r{<preferences type=\"yaml\">---\s?\n:gem: ruby\n</preferences>}, @xml + def test_should_serialize_hash + assert_match %r{<preferences>\s*<gem>ruby</gem>\s*</preferences>}m, @xml end end |