File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -878,6 +878,27 @@ def test_reverse_order_with_function_other_predicates_coerced
878
878
# We have implicit ordering, via FETCH.
879
879
coerce_tests! %r{doesn't have implicit ordering}
880
880
881
+ # We have implicit ordering, via FETCH.
882
+ coerce_tests! :test_reorder_with_take
883
+ def test_reorder_with_take_coerced
884
+ sql_log = capture_sql do
885
+ assert Post . order ( :title ) . reorder ( nil ) . take
886
+ end
887
+ assert sql_log . none? { |sql | /order by [posts].[title]/i . match? ( sql ) } , "ORDER BY title was used in the query: #{ sql_log } "
888
+ assert sql_log . all? { |sql | /order by \[ posts\] \. \[ id\] /i . match? ( sql ) } , "default ORDER BY ID was not used in the query: #{ sql_log } "
889
+ end
890
+
891
+ # We have implicit ordering, via FETCH.
892
+ coerce_tests! :test_reorder_with_first
893
+ def test_reorder_with_first_coerced
894
+ sql_log = capture_sql do
895
+ assert Post . order ( :title ) . reorder ( nil ) . first
896
+ end
897
+ assert sql_log . none? { |sql | /order by [posts].[title]/i . match? ( sql ) } , "ORDER BY title was used in the query: #{ sql_log } "
898
+ assert sql_log . all? { |sql | /order by \[ posts\] \. \[ id\] /i . match? ( sql ) } , "default ORDER BY ID was not used in the query: #{ sql_log } "
899
+ end
900
+
901
+
881
902
# We are not doing order duplicate removal anymore.
882
903
coerce_tests! :test_order_using_scoping
883
904
You can’t perform that action at this time.
0 commit comments