diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-27 01:38:04 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-27 01:38:04 +0900 |
commit | aa9bc1e8f023b227d77aeee99cefde48c247b88d (patch) | |
tree | 80b2574e898e0a51e41c3f6cb841d9b92b52092b /activerecord/test | |
parent | 350ad01b815979f492f5f359991c9be707d5e3b5 (diff) | |
download | rails-aa9bc1e8f023b227d77aeee99cefde48c247b88d.tar.gz rails-aa9bc1e8f023b227d77aeee99cefde48c247b88d.tar.bz2 rails-aa9bc1e8f023b227d77aeee99cefde48c247b88d.zip |
Fix random CI failure due to non-deterministic sorting order
https://buildkite.com/rails/rails/builds/59106#596284a1-4692-4640-8a50-c4286e173bbb/115-126
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 5a3bd1bd4a..a7f09e6de0 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1490,10 +1490,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal [posts(:welcome)], relation.to_a author_posts = relation.except(:order, :limit) - assert_equal Post.where(author_id: 1).to_a, author_posts.to_a + assert_equal Post.where(author_id: 1).sort_by(&:id), author_posts.sort_by(&:id) all_posts = relation.except(:where, :order, :limit) - assert_equal Post.all, all_posts + assert_equal Post.all.sort_by(&:id), all_posts.sort_by(&:id) end def test_only @@ -1501,10 +1501,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal [posts(:welcome)], relation.to_a author_posts = relation.only(:where) - assert_equal Post.where(author_id: 1).to_a, author_posts.to_a + assert_equal Post.where(author_id: 1).sort_by(&:id), author_posts.sort_by(&:id) - all_posts = relation.only(:limit) - assert_equal Post.limit(1).to_a, all_posts.to_a + all_posts = relation.only(:order) + assert_equal Post.order("id ASC").to_a, all_posts.to_a end def test_anonymous_extension |