diff options
author | rick <technoweenie@gmail.com> | 2008-05-31 17:13:11 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2008-05-31 17:13:11 -0700 |
commit | 72483c0d4c1e4ea794919974100acc2f255f6fd2 (patch) | |
tree | 1519e9e4dd95c3c0ac13e1d0bf8bc0e2b15fc5a9 /activerecord/test | |
parent | a6e79083273dfb1a62aa8ff02db07454c65729ff (diff) | |
download | rails-72483c0d4c1e4ea794919974100acc2f255f6fd2.tar.gz rails-72483c0d4c1e4ea794919974100acc2f255f6fd2.tar.bz2 rails-72483c0d4c1e4ea794919974100acc2f255f6fd2.zip |
Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [#114 state:resolved]
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/cases/inheritance_test.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 27394924a1..f09b617e6d 100755 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -5,7 +5,23 @@ require 'models/subscriber' class InheritanceTest < ActiveRecord::TestCase fixtures :companies, :projects, :subscribers, :accounts - + + def test_class_with_store_full_sti_class_returns_full_name + old = ActiveRecord::Base.store_full_sti_class + ActiveRecord::Base.store_full_sti_class = true + assert_equal 'Namespaced::Company', Namespaced::Company.sti_name + ensure + ActiveRecord::Base.store_full_sti_class = old + 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 + assert_equal 'Company', Namespaced::Company.sti_name + ensure + ActiveRecord::Base.store_full_sti_class = old + end + def test_should_store_demodulized_class_name_with_store_full_sti_class_option_disabled old = ActiveRecord::Base.store_full_sti_class ActiveRecord::Base.store_full_sti_class = false |