@@ -709,11 +709,11 @@ def test_clear_query_cache_is_called_on_all_connections
709
709
def test_query_cache_uncached_dirties
710
710
mw = middleware { |env |
711
711
Post . first
712
- assert_no_changes -> { ActiveRecord ::Base . connection . query_cache . size } do
712
+ assert_no_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } do
713
713
Post . uncached ( dirties : false ) { Post . create! ( title : "a new post" , body : "and a body" ) }
714
714
end
715
715
716
- assert_changes -> { ActiveRecord ::Base . connection . query_cache . size } , from : 1 , to : 0 do
716
+ assert_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } , from : 1 , to : 0 do
717
717
Post . uncached ( dirties : true ) { Post . create! ( title : "a new post" , body : "and a body" ) }
718
718
end
719
719
}
@@ -723,12 +723,12 @@ def test_query_cache_uncached_dirties
723
723
def test_query_cache_connection_uncached_dirties
724
724
mw = middleware { |env |
725
725
Post . first
726
- assert_no_changes -> { ActiveRecord ::Base . connection . query_cache . size } do
727
- Post . connection . uncached ( dirties : false ) { Post . create! ( title : "a new post" , body : "and a body" ) }
726
+ assert_no_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } do
727
+ Post . lease_connection . uncached ( dirties : false ) { Post . create! ( title : "a new post" , body : "and a body" ) }
728
728
end
729
729
730
- assert_changes -> { ActiveRecord ::Base . connection . query_cache . size } , from : 1 , to : 0 do
731
- Post . connection . uncached ( dirties : true ) { Post . create! ( title : "a new post" , body : "and a body" ) }
730
+ assert_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } , from : 1 , to : 0 do
731
+ Post . lease_connection . uncached ( dirties : true ) { Post . create! ( title : "a new post" , body : "and a body" ) }
732
732
end
733
733
}
734
734
mw . call ( { } )
@@ -737,7 +737,7 @@ def test_query_cache_connection_uncached_dirties
737
737
def test_query_cache_uncached_dirties_disabled_with_nested_cache
738
738
mw = middleware { |env |
739
739
Post . first
740
- assert_changes -> { ActiveRecord ::Base . connection . query_cache . size } , from : 1 , to : 0 do
740
+ assert_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } , from : 1 , to : 0 do
741
741
Post . uncached ( dirties : false ) do
742
742
Post . cache do
743
743
Post . create! ( title : "a new post" , body : "and a body" )
@@ -746,9 +746,9 @@ def test_query_cache_uncached_dirties_disabled_with_nested_cache
746
746
end
747
747
748
748
Post . first
749
- assert_changes -> { ActiveRecord ::Base . connection . query_cache . size } , from : 1 , to : 0 do
750
- Post . connection . uncached ( dirties : false ) do
751
- Post . connection . cache do
749
+ assert_changes -> { ActiveRecord ::Base . lease_connection . query_cache . size } , from : 1 , to : 0 do
750
+ Post . lease_connection . uncached ( dirties : false ) do
751
+ Post . lease_connection . cache do
752
752
Post . create! ( title : "a new post" , body : "and a body" )
753
753
end
754
754
end
0 commit comments