File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1149,6 +1149,15 @@ def test_update_column_touch_option
1149
1149
end
1150
1150
end
1151
1151
1152
+ def test_update_column_touch_option_with_specific_time
1153
+ topic = Topic . find ( 1 )
1154
+ new_updated_at = Date . parse ( "2024-03-31 12:00:00" )
1155
+
1156
+ assert_changes -> { topic . updated_at } , to : new_updated_at do
1157
+ topic . update_column ( :title , "super_title" , touch : { time : new_updated_at } )
1158
+ end
1159
+ end
1160
+
1152
1161
def test_update_column_should_not_use_setter_method
1153
1162
dev = Developer . find ( 1 )
1154
1163
dev . instance_eval { def salary = ( value ) ; write_attribute ( :salary , value * 2 ) ; end }
@@ -1278,6 +1287,15 @@ def test_update_columns_touch_option_not_overwrite_explicit_attribute_with_strin
1278
1287
end
1279
1288
end
1280
1289
1290
+ def test_update_columns_touch_option_with_specific_time
1291
+ topic = Topic . find ( 1 )
1292
+ new_updated_at = Date . parse ( "2024-03-31 12:00:00" )
1293
+
1294
+ assert_changes -> { topic . updated_at } , to : new_updated_at do
1295
+ topic . update_columns ( title : "super_title" , touch : { time : new_updated_at } )
1296
+ end
1297
+ end
1298
+
1281
1299
def test_update_columns_should_not_use_setter_method
1282
1300
dev = Developer . find ( 1 )
1283
1301
dev . instance_eval { def salary = ( value ) ; write_attribute ( :salary , value * 2 ) ; end }
You can’t perform that action at this time.
0 commit comments