diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-17 12:39:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-17 12:39:44 +0900 |
commit | 5ca19efafea08984ff1c464c64969f82b9db3569 (patch) | |
tree | 89d224f2a2ba7b6f5ca998c36d9e0ec2a1e87cf5 /activerecord/test | |
parent | 311f00116738df175c12cb36bebe79587f88e00b (diff) | |
parent | db930ec0fddc2e5e95029b5d761e1207a10b1488 (diff) | |
download | rails-5ca19efafea08984ff1c464c64969f82b9db3569.tar.gz rails-5ca19efafea08984ff1c464c64969f82b9db3569.tar.bz2 rails-5ca19efafea08984ff1c464c64969f82b9db3569.zip |
Merge pull request #35274 from AlexBrodianoi/fix_does_not_support_reverse
Raise ActiveRecord::IrreversibleOrderError if nulls first/last is not a single ordering argument.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index b1eba05933..c82f93a3f0 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -291,8 +291,17 @@ class RelationTest < ActiveRecord::TestCase Topic.order(Arel.sql("title NULLS FIRST")).reverse_order end assert_raises(ActiveRecord::IrreversibleOrderError) do + Topic.order(Arel.sql("title NULLS FIRST")).reverse_order + end + assert_raises(ActiveRecord::IrreversibleOrderError) do Topic.order(Arel.sql("title nulls last")).reverse_order end + assert_raises(ActiveRecord::IrreversibleOrderError) do + Topic.order(Arel.sql("title NULLS FIRST, author_name")).reverse_order + end + assert_raises(ActiveRecord::IrreversibleOrderError) do + Topic.order(Arel.sql("author_name, title nulls last")).reverse_order + end end def test_default_reverse_order_on_table_without_primary_key |