diff options
author | Matthew Draper <matthew@trebex.net> | 2016-01-11 16:28:34 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-01-12 05:43:58 +1030 |
commit | 8ce0175d50f7fafe648afb8342e17c0898e0ff7f (patch) | |
tree | 7675bbdcd7c716d606cda214fca755536042da16 /activerecord/test/cases/base_test.rb | |
parent | 179df9df68396a6916f62192971838b7e73d5f76 (diff) | |
download | rails-8ce0175d50f7fafe648afb8342e17c0898e0ff7f.tar.gz rails-8ce0175d50f7fafe648afb8342e17c0898e0ff7f.tar.bz2 rails-8ce0175d50f7fafe648afb8342e17c0898e0ff7f.zip |
Active scopes apply to child classes, though not parents/siblings
While the commit message (and changelog example) in
5e0b555b453ea2ca36986c111512627d806101e7 talked about sibling classes,
the added test had a child ignore its parent's scoping, which seems less
reasonable.
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index ba3e16bdb2..ecdf508e3e 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1275,9 +1275,10 @@ class BasicsTest < ActiveRecord::TestCase UnloadablePost.send(:current_scope=, UnloadablePost.all) UnloadablePost.unloadable - assert_not_nil ActiveRecord::Scoping::ScopeRegistry.value_for(:current_scope, "UnloadablePost") + klass = UnloadablePost + assert_not_nil ActiveRecord::Scoping::ScopeRegistry.value_for(:current_scope, klass) ActiveSupport::Dependencies.remove_unloadable_constants! - assert_nil ActiveRecord::Scoping::ScopeRegistry.value_for(:current_scope, "UnloadablePost") + assert_nil ActiveRecord::Scoping::ScopeRegistry.value_for(:current_scope, klass) ensure Object.class_eval{ remove_const :UnloadablePost } if defined?(UnloadablePost) end |