diff options
author | Franck Verrot <franck@verrot.fr> | 2010-11-18 09:01:45 +0100 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-15 14:02:30 -0800 |
commit | aa40543022303d8a1b695e73ed71406c0da15bde (patch) | |
tree | 31d62f108cf72858685904417cbaaac4c7b3fd0f /activerecord/test | |
parent | fe0db2b80588446b34f5f89bbe73f04b88fb06c9 (diff) | |
download | rails-aa40543022303d8a1b695e73ed71406c0da15bde.tar.gz rails-aa40543022303d8a1b695e73ed71406c0da15bde.tar.bz2 rails-aa40543022303d8a1b695e73ed71406c0da15bde.zip |
Provide test for #4840: to_xml doesn't work in such case: Event.select('title as t').to_xml
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/xml_serialization_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/xml_serialization_test.rb b/activerecord/test/cases/xml_serialization_test.rb index 2003e25e35..a6074b23e7 100644 --- a/activerecord/test/cases/xml_serialization_test.rb +++ b/activerecord/test/cases/xml_serialization_test.rb @@ -262,4 +262,10 @@ class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase assert array.include? 'github' end + def test_should_support_aliased_attributes + xml = Author.select("name as firstname").to_xml + array = Hash.from_xml(xml)['authors'] + assert_equal array.size, array.select { |author| author.has_key? 'firstname' }.size + end + end |