@@ -1018,7 +1018,7 @@ def test_implicit_order_column_is_configurable_coerced
1018
1018
assert_equal topics ( :fifth ) , Topic . first
1019
1019
assert_equal topics ( :third ) , Topic . last
1020
1020
1021
- c = Topic . connection
1021
+ c = Topic . lease_connection
1022
1022
assert_sql ( /ORDER BY #{ Regexp . escape ( c . quote_table_name ( "topics.title" ) ) } DESC, #{ Regexp . escape ( c . quote_table_name ( "topics.id" ) ) } DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i ) {
1023
1023
Topic . last
1024
1024
}
@@ -1032,7 +1032,7 @@ def test_implicit_order_set_to_primary_key_coerced
1032
1032
old_implicit_order_column = Topic . implicit_order_column
1033
1033
Topic . implicit_order_column = "id"
1034
1034
1035
- c = Topic . connection
1035
+ c = Topic . lease_connection
1036
1036
assert_sql ( /ORDER BY #{ Regexp . escape ( c . quote_table_name ( "topics.id" ) ) } DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i ) {
1037
1037
Topic . last
1038
1038
}
@@ -1046,7 +1046,7 @@ def test_implicit_order_for_model_without_primary_key_coerced
1046
1046
old_implicit_order_column = NonPrimaryKey . implicit_order_column
1047
1047
NonPrimaryKey . implicit_order_column = "created_at"
1048
1048
1049
- c = NonPrimaryKey . connection
1049
+ c = NonPrimaryKey . lease_connection
1050
1050
1051
1051
assert_sql ( /ORDER BY #{ Regexp . escape ( c . quote_table_name ( "non_primary_keys.created_at" ) ) } DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i ) {
1052
1052
NonPrimaryKey . last
@@ -1067,7 +1067,7 @@ def test_member_on_unloaded_relation_with_composite_primary_key_coerced
1067
1067
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
1068
1068
coerce_tests! :test_implicit_order_column_prepends_query_constraints
1069
1069
def test_implicit_order_column_prepends_query_constraints_coerced
1070
- c = ClothingItem . connection
1070
+ c = ClothingItem . lease_connection
1071
1071
ClothingItem . implicit_order_column = "description"
1072
1072
quoted_type = Regexp . escape ( c . quote_table_name ( "clothing_items.clothing_type" ) )
1073
1073
quoted_color = Regexp . escape ( c . quote_table_name ( "clothing_items.color" ) )
@@ -1083,7 +1083,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
1083
1083
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
1084
1084
coerce_tests! %r{#last for a model with composite query constraints}
1085
1085
test "#last for a model with composite query constraints coerced" do
1086
- c = ClothingItem . connection
1086
+ c = ClothingItem . lease_connection
1087
1087
quoted_type = Regexp . escape ( c . quote_table_name ( "clothing_items.clothing_type" ) )
1088
1088
quoted_color = Regexp . escape ( c . quote_table_name ( "clothing_items.color" ) )
1089
1089
@@ -1095,7 +1095,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
1095
1095
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
1096
1096
coerce_tests! %r{#first for a model with composite query constraints}
1097
1097
test "#first for a model with composite query constraints coerced" do
1098
- c = ClothingItem . connection
1098
+ c = ClothingItem . lease_connection
1099
1099
quoted_type = Regexp . escape ( c . quote_table_name ( "clothing_items.clothing_type" ) )
1100
1100
quoted_color = Regexp . escape ( c . quote_table_name ( "clothing_items.color" ) )
1101
1101
@@ -1107,7 +1107,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
1107
1107
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
1108
1108
coerce_tests! :test_implicit_order_column_reorders_query_constraints
1109
1109
def test_implicit_order_column_reorders_query_constraints_coerced
1110
- c = ClothingItem . connection
1110
+ c = ClothingItem . lease_connection
1111
1111
ClothingItem . implicit_order_column = "color"
1112
1112
quoted_type = Regexp . escape ( c . quote_table_name ( "clothing_items.clothing_type" ) )
1113
1113
quoted_color = Regexp . escape ( c . quote_table_name ( "clothing_items.color" ) )
@@ -1131,7 +1131,7 @@ def test_include_on_unloaded_relation_with_composite_primary_key_coerced
1131
1131
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
1132
1132
coerce_tests! :test_nth_to_last_with_order_uses_limit
1133
1133
def test_nth_to_last_with_order_uses_limit_coerced
1134
- c = Topic . connection
1134
+ c = Topic . lease_connection
1135
1135
assert_sql ( /ORDER BY #{ Regexp . escape ( c . quote_table_name ( "topics.id" ) ) } DESC OFFSET @(\d ) ROWS FETCH NEXT @(\d ) ROWS ONLY.*@\1 = 1.*@\2 = 1/i ) do
1136
1136
Topic . second_to_last
1137
1137
end
@@ -2338,7 +2338,7 @@ def test_preloads_has_many_on_model_with_a_composite_primary_key_through_id_attr
2338
2338
assert_equal 2 , sql . size
2339
2339
preload_sql = sql . last
2340
2340
2341
- c = Cpk ::OrderAgreement . connection
2341
+ c = Cpk ::OrderAgreement . lease_connection
2342
2342
order_id_column = Regexp . escape ( c . quote_table_name ( "cpk_order_agreements.order_id" ) )
2343
2343
order_id_constraint = /#{ order_id_column } = @0.*@0 = \d +$/
2344
2344
expectation = /SELECT.*WHERE.* #{ order_id_constraint } /
@@ -2362,7 +2362,7 @@ def test_preloads_belongs_to_a_composite_primary_key_model_through_id_attribute_
2362
2362
assert_equal 2 , sql . size
2363
2363
preload_sql = sql . last
2364
2364
2365
- c = Cpk ::Order . connection
2365
+ c = Cpk ::Order . lease_connection
2366
2366
order_id = Regexp . escape ( c . quote_table_name ( "cpk_orders.id" ) )
2367
2367
order_constraint = /#{ order_id } = @0.*@0 = \d +$/
2368
2368
expectation = /SELECT.*WHERE.* #{ order_constraint } /
0 commit comments