diff options
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/scoping/named_scoping_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/models/topic.rb | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index ea71a5ce28..03f8a4f7c9 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -303,6 +303,13 @@ class NamedScopingTest < ActiveRecord::TestCase assert_equal "lifo", topic.author_name end + def test_deprecated_delegating_private_method + assert_deprecated do + scope = Topic.all.by_private_lifo + assert_not scope.instance_variable_get(:@delegate_to_klass) + end + end + def test_reserved_scope_names klass = Class.new(ActiveRecord::Base) do self.table_name = "topics" diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index a924cf86ae..fa50eeb6a4 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -12,12 +12,13 @@ class Topic < ActiveRecord::Base scope :scope_with_lambda, lambda { all } - scope :by_lifo, -> { where(author_name: author_name) } + scope :by_private_lifo, -> { where(author_name: private_lifo) } + scope :by_lifo, -> { where(author_name: "lifo") } scope :replied, -> { where "replies_count > 0" } class << self private - def author_name + def private_lifo "lifo" end end |