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

Fix test failure on PostgreSQL by sorting the result before comparison

This commit is contained in:
Prathamesh Sonpatki 2016-01-19 22:45:25 +05:30
parent 3ea4476942
commit e55ba530c1

View file

@ -575,18 +575,19 @@ class InheritanceAttributeMappingTest < ActiveRecord::TestCase
Empire.create! name: 'an Empire'
assert_equal [["a Startup", "omg_inheritance_attribute_mapping_test/startup"],
["an Empire", "omg_inheritance_attribute_mapping_test/empire"]], ActiveRecord::Base.connection.select_rows('SELECT name, type FROM companies')
["an Empire", "omg_inheritance_attribute_mapping_test/empire"]], ActiveRecord::Base.connection.select_rows('SELECT name, type FROM companies').sort
assert_equal [["a Startup", "InheritanceAttributeMappingTest::Startup"],
["an Empire", "InheritanceAttributeMappingTest::Empire"]], Company.all.map { |a| [a.name, a.type] }
["an Empire", "InheritanceAttributeMappingTest::Empire"]], Company.all.map { |a| [a.name, a.type] }.sort
startup = Startup.first
startup.becomes! Empire
startup.save!
assert_equal [["a Startup", "omg_inheritance_attribute_mapping_test/empire"],
["an Empire", "omg_inheritance_attribute_mapping_test/empire"]], ActiveRecord::Base.connection.select_rows('SELECT name, type FROM companies')
["an Empire", "omg_inheritance_attribute_mapping_test/empire"]], ActiveRecord::Base.connection.select_rows('SELECT name, type FROM companies').sort
assert_equal [["a Startup", "InheritanceAttributeMappingTest::Empire"],
["an Empire", "InheritanceAttributeMappingTest::Empire"]], Company.all.map { |a| [a.name, a.type] }
["an Empire", "InheritanceAttributeMappingTest::Empire"]], Company.all.map { |a| [a.name, a.type] }.sort
end
def test_polymorphic_associations_custom_type