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

Test the serialized types of virtual columns in XML

The previous tests were passing, because nothing ever looked at the
generated XML. What was previously being generated was
`<firstname type="NilClass">...`, which is not consistent with all other
cases where there is not a known type.
This commit is contained in:
Geoff Petrie & Sean Griffin 2014-06-01 11:40:40 -06:00 committed by Geoff Petrie
parent 260c384bdb
commit 29cbfa2f33
2 changed files with 3 additions and 4 deletions

View file

@ -184,8 +184,6 @@ module ActiveRecord #:nodoc:
super
elsif klass.columns_hash.key?(name)
klass.columns_hash[name].type
else
NilClass
end
{ :text => :string,

View file

@ -416,8 +416,9 @@ class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase
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
Author.all.each do |author|
assert xml.include?(%(<firstname>#{author.name}</firstname>)), xml
end
end
def test_array_to_xml_including_has_many_association