File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -613,6 +613,26 @@ def test_reverse_order_with_function_other_predicates_coerced
613613 # Leave it up to users to format selects/functions so HAVING works correctly.
614614 coerce_tests! :test_multiple_where_and_having_clauses
615615 coerce_tests! :test_having_with_binds_for_both_where_and_having
616+
617+ # Find any limit via our expression.
618+ coerce_tests! %r{relations don't load all records in #inspect}
619+ def test_relations_dont_load_all_records_in_inspect_coerced
620+ assert_sql ( /NEXT @0 ROWS.*@0 = \d +/ ) do
621+ Post . all . inspect
622+ end
623+ end
624+
625+ # I wanted to add `.order("author_id")` scope to avoid error: Column "posts.id" is invalid in the ORDER BY
626+ # However, this pull request on Rails core drops order on exists relation. https://github.com/rails/rails/pull/28699
627+ # so we are skipping all together.
628+ coerce_tests! :test_empty_complex_chained_relations
629+
630+ # Use LEN() vs length() function.
631+ coerce_tests! :test_reverse_arel_assoc_order_with_function
632+ def test_reverse_arel_assoc_order_with_function_coerced
633+ topics = Topic . order ( Arel . sql ( "LEN(title)" ) => :asc ) . reverse_order
634+ assert_equal topics ( :second ) . title , topics . first . title
635+ end
616636end
617637
618638
You can’t perform that action at this time.
0 commit comments