aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping/relation_scoping_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/scoping/relation_scoping_test.rb')
-rw-r--r--activerecord/test/cases/scoping/relation_scoping_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb
index 8ab0782bbf..50b514d464 100644
--- a/activerecord/test/cases/scoping/relation_scoping_test.rb
+++ b/activerecord/test/cases/scoping/relation_scoping_test.rb
@@ -421,6 +421,18 @@ class HasManyScopingTest < ActiveRecord::TestCase
end
end
+ def test_none_scoping
+ Comment.none.scoping do
+ assert_equal 2, @welcome.comments.count
+ assert_equal "a comment...", @welcome.comments.what_are_you
+ end
+
+ Comment.where("1=1").scoping do
+ assert_equal 2, @welcome.comments.count
+ assert_equal "a comment...", @welcome.comments.what_are_you
+ end
+ end
+
def test_should_maintain_default_scope_on_associations
magician = BadReference.find(1)
assert_equal [magician], people(:michael).bad_references
@@ -461,4 +473,16 @@ class HasAndBelongsToManyScopingTest < ActiveRecord::TestCase
assert_equal "a category...", @welcome.categories.what_are_you
end
end
+
+ def test_none_scoping
+ Category.none.scoping do
+ assert_equal 2, @welcome.categories.count
+ assert_equal "a category...", @welcome.categories.what_are_you
+ end
+
+ Category.where("1=1").scoping do
+ assert_equal 2, @welcome.categories.count
+ assert_equal "a category...", @welcome.categories.what_are_you
+ end
+ end
end