File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -858,6 +858,27 @@ def test_reverse_order_with_function_other_predicates_coerced
858858 # We have implicit ordering, via FETCH.
859859 coerce_tests! %r{doesn't have implicit ordering}
860860
861+ # We have implicit ordering, via FETCH.
862+ coerce_tests! :test_reorder_with_take_coerced
863+ def test_reorder_with_take
864+ sql_log = capture_sql do
865+ assert Post . order ( :title ) . reorder ( nil ) . take
866+ end
867+ assert sql_log . none? { |sql | /order by [posts].[title]/i . match? ( sql ) } , "ORDER BY title was used in the query: #{ sql_log } "
868+ assert sql_log . all? { |sql | /order by \[ posts\] \. \[ id\] /i . match? ( sql ) } , "default ORDER BY ID was not used in the query: #{ sql_log } "
869+ end
870+
871+ # We have implicit ordering, via FETCH.
872+ coerce_tests! :test_reorder_with_first_coerced
873+ def test_reorder_with_first_coerced
874+ sql_log = capture_sql do
875+ assert Post . order ( :title ) . reorder ( nil ) . first
876+ end
877+ assert sql_log . none? { |sql | /order by [posts].[title]/i . match? ( sql ) } , "ORDER BY title was used in the query: #{ sql_log } "
878+ assert sql_log . all? { |sql | /order by \[ posts\] \. \[ id\] /i . match? ( sql ) } , "default ORDER BY ID was not used in the query: #{ sql_log } "
879+ end
880+
881+
861882 # We are not doing order duplicate removal anymore.
862883 coerce_tests! :test_order_using_scoping
863884
You can’t perform that action at this time.
0 commit comments