aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-30 16:02:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-30 16:03:05 -0700
commit0238228e5d3ce1747a6f1d618693ffd44f947561 (patch)
tree06188a3d15aa7db2288aad0aac06aee68d087e6b /activerecord/test/cases
parent15419a5dc692be997d7637e40435a3d0d0fa4c1c (diff)
downloadrails-0238228e5d3ce1747a6f1d618693ffd44f947561.tar.gz
rails-0238228e5d3ce1747a6f1d618693ffd44f947561.tar.bz2
rails-0238228e5d3ce1747a6f1d618693ffd44f947561.zip
type_name should check for blank because people may have messed up databases
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/inheritance_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index 8c09fc4d59..31679b2efe 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -14,6 +14,20 @@ class InheritanceTest < ActiveRecord::TestCase
ActiveRecord::Base.store_full_sti_class = old
end
+ def test_class_with_blank_sti_name
+ company = Company.find(:first)
+ company = company.clone
+ company.extend(Module.new {
+ def read_attribute(name)
+ return ' ' if name == 'type'
+ super
+ end
+ })
+ company.save!
+ company = Company.find(:all).find { |x| x.id == company.id }
+ assert_equal ' ', company.type
+ end
+
def test_class_without_store_full_sti_class_returns_demodulized_name
old = ActiveRecord::Base.store_full_sti_class
ActiveRecord::Base.store_full_sti_class = false