1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Provide test for #4840: to_xml doesn't work in such case: Event.select('title as t').to_xml

This commit is contained in:
Franck Verrot 2010-11-18 09:01:45 +01:00 committed by Aaron Patterson
parent fe0db2b805
commit aa40543022

View file

@ -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