aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-05-13 11:08:10 +0200
committerYves Senn <yves.senn@gmail.com>2015-05-13 11:08:10 +0200
commit15354b6fd0e73a321b695ac3961eac8df9d6125d (patch)
treee7965a8841a18cc706e8a8b7e207f377acf7f690 /activerecord/test
parent6eaa5b17a094e5cbbdedad578e8bb2f5ae187aac (diff)
parentcbd66b430b6553e468bcdaa94af661a2d8b69d81 (diff)
downloadrails-15354b6fd0e73a321b695ac3961eac8df9d6125d.tar.gz
rails-15354b6fd0e73a321b695ac3961eac8df9d6125d.tar.bz2
rails-15354b6fd0e73a321b695ac3961eac8df9d6125d.zip
Merge branch 'sti-subclass-from-attributes' of https://github.com/agrobbin/rails into agrobbin-sti-subclass-from-attributes
Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/inheritance_test.rb7
-rw-r--r--activerecord/test/models/company.rb3
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index 278fa63e04..0286c85939 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -217,6 +217,13 @@ class InheritanceTest < ActiveRecord::TestCase
assert_nothing_raised { Client.new(type: 'VerySpecialClient') }
end
+ def test_new_without_storing_full_sti_class
+ without_store_full_sti_class do
+ item = Company.new(type: 'SpecialCo')
+ assert_instance_of Company::SpecialCo, item
+ end
+ end
+
def test_new_with_autoload_paths
path = File.expand_path('../../models/autoloadable', __FILE__)
ActiveSupport::Dependencies.autoload_paths << path
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index 6961f8fd6f..67936e8e5d 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -26,6 +26,9 @@ class Company < AbstractCompany
def private_method
"I am Jack's innermost fears and aspirations"
end
+
+ class SpecialCo < Company
+ end
end
module Namespaced