File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,22 @@ def test_cache_does_not_wrap_string_results_in_arrays_coerced
521521
522522require 'models/post'
523523class RelationTest < ActiveRecord ::TestCase
524+ # Use LEN vs LENGTH function.
525+ coerce_tests! :test_reverse_order_with_function
526+ def test_reverse_order_with_function_coerced
527+ topics = Topic . order ( "LEN(title)" ) . reverse_order
528+ assert_equal topics ( :second ) . title , topics . first . title
529+ end
530+
531+ # Use LEN vs LENGTH function.
532+ coerce_tests! :test_reverse_order_with_function_other_predicates
533+ def test_reverse_order_with_function_other_predicates_coerced
534+ topics = Topic . order ( "author_name, LEN(title), id" ) . reverse_order
535+ assert_equal topics ( :second ) . title , topics . first . title
536+ topics = Topic . order ( "LEN(author_name), id, LEN(title)" ) . reverse_order
537+ assert_equal topics ( :fifth ) . title , topics . first . title
538+ end
539+
524540 # We have implicit ordering, via FETCH.
525541 coerce_tests! %r{doesn't have implicit ordering}
526542
You can’t perform that action at this time.
0 commit comments