aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/named_scope_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/named_scope_test.rb')
-rw-r--r--activerecord/test/cases/named_scope_test.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index fb050c3e52..9b20ea08de 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -64,7 +64,7 @@ class NamedScopeTest < ActiveRecord::TestCase
assert Reply.scopes.include?(:base)
assert_equal Reply.find(:all), Reply.base
end
-
+
def test_classes_dont_inherit_subclasses_scopes
assert !ActiveRecord::Base.scopes.include?(:base)
end
@@ -246,6 +246,12 @@ class NamedScopeTest < ActiveRecord::TestCase
assert_no_queries { assert topics.any? }
end
+ def test_model_class_should_respond_to_any
+ assert Topic.any?
+ Topic.delete_all
+ assert !Topic.any?
+ end
+
def test_many_should_not_load_results
topics = Topic.base
assert_queries(2) do
@@ -280,6 +286,15 @@ class NamedScopeTest < ActiveRecord::TestCase
assert Topic.base.many?
end
+ def test_model_class_should_respond_to_many
+ Topic.delete_all
+ assert !Topic.many?
+ Topic.create!
+ assert !Topic.many?
+ Topic.create!
+ assert Topic.many?
+ end
+
def test_should_build_on_top_of_scope
topic = Topic.approved.build({})
assert topic.approved