Added a :camelize option to ActiveRecord and Hash to_xml serialization and from_xml deserialization

Signed-off-by: Michael Koziarski <michael@koziarski.com>
This commit is contained in:
Bruce Krysiak
2008-12-08 16:38:04 -08:00
committed by Michael Koziarski
parent 96b815d7e8
commit aa5cdb0d47
4 changed files with 43 additions and 14 deletions

View File

@@ -31,6 +31,13 @@ class XmlSerializationTest < ActiveRecord::TestCase
assert_match %r{<created_at}, @xml
end
def test_should_allow_camelized_tags
@xml = Contact.new.to_xml :root => 'xml_contact', :camelize => true
assert_match %r{^<XmlContact>}, @xml
assert_match %r{</XmlContact>$}, @xml
assert_match %r{<CreatedAt}, @xml
end
def test_should_include_yielded_additions
@xml = Contact.new.to_xml do |xml|
xml.creator "David"