diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-21 03:51:20 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-21 03:51:20 +0900 |
commit | 4650874073bef4f02da3c2b0bfc4ba2a6fd5d562 (patch) | |
tree | df244b1c781a199ee23271e41867253fb63b6d44 | |
parent | dfa857ef25b5abf7485e4f7115e4a311e00c599c (diff) | |
download | rails-4650874073bef4f02da3c2b0bfc4ba2a6fd5d562.tar.gz rails-4650874073bef4f02da3c2b0bfc4ba2a6fd5d562.tar.bz2 rails-4650874073bef4f02da3c2b0bfc4ba2a6fd5d562.zip |
More exercise test cases for order by table name qualified column name
This covers what #34626 fixes.
-rw-r--r-- | activerecord/test/cases/base_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 63528d09d5..866818b2ab 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1055,23 +1055,23 @@ class BasicsTest < ActiveRecord::TestCase end def test_find_ordered_last - last = Developer.all.merge!(order: "developers.salary ASC").last - assert_equal last, Developer.all.merge!(order: "developers.salary ASC").to_a.last + last = Developer.order("developers.salary ASC").last + assert_equal last, Developer.order("developers.salary": "ASC").to_a.last end def test_find_reverse_ordered_last - last = Developer.all.merge!(order: "developers.salary DESC").last - assert_equal last, Developer.all.merge!(order: "developers.salary DESC").to_a.last + last = Developer.order("developers.salary DESC").last + assert_equal last, Developer.order("developers.salary": "DESC").to_a.last end def test_find_multiple_ordered_last - last = Developer.all.merge!(order: "developers.name, developers.salary DESC").last - assert_equal last, Developer.all.merge!(order: "developers.name, developers.salary DESC").to_a.last + last = Developer.order("developers.name, developers.salary DESC").last + assert_equal last, Developer.order(:"developers.name", "developers.salary": "DESC").to_a.last end def test_find_keeps_multiple_order_values - combined = Developer.all.merge!(order: "developers.name, developers.salary").to_a - assert_equal combined, Developer.all.merge!(order: ["developers.name", "developers.salary"]).to_a + combined = Developer.order("developers.name, developers.salary").to_a + assert_equal combined, Developer.order(:"developers.name", :"developers.salary").to_a end def test_find_keeps_multiple_group_values |