From 8dbf337e0a7e4db521aa2f5f992609fae98c329e Mon Sep 17 00:00:00 2001 From: Evan Petrie Date: Fri, 28 Sep 2012 14:19:31 -0700 Subject: backport 68677ffb8298105eb9d3efa26d928dd88cc5e006 --- activerecord/test/cases/relation_scoping_test.rb | 4 ++++ activerecord/test/cases/relations_test.rb | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index cfcd11ca46..f33e765c59 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -548,4 +548,8 @@ class DefaultScopingTest < ActiveRecord::TestCase end threads.each(&:join) end + + def test_default_scope_unscoped_is_not_cached + assert_not_equal DeveloperCalledDavid.unscoped.object_id, DeveloperCalledDavid.unscoped.object_id + end end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 7639585649..b24df47efd 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1093,6 +1093,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'honda', FastCar.unscoped { FastCar.order_using_old_style.limit(1).first.name} end + def test_unscoped_relation_clones + assert_not_equal CoolCar.unscoped.object_id, CoolCar.unscoped.object_id + end + def test_intersection_with_array relation = Author.where(:name => "David") rails_author = relation.first -- cgit v1.2.3