aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-13 20:41:19 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-08-13 20:41:19 +0900
commit625bdb164ed7cb06dd88bec57c338b63460628d7 (patch)
tree75e66d2e38be34b5b3e14748208df0eecaf7bdd6 /activerecord/test/cases/scoping
parente3962308e7947f3d99c70c192e2d1356d3420e1e (diff)
downloadrails-625bdb164ed7cb06dd88bec57c338b63460628d7.tar.gz
rails-625bdb164ed7cb06dd88bec57c338b63460628d7.tar.bz2
rails-625bdb164ed7cb06dd88bec57c338b63460628d7.zip
Fix random CI failure due to non-deterministic sorting order
https://travis-ci.org/rails/rails/jobs/263617099#L769-L775
Diffstat (limited to 'activerecord/test/cases/scoping')
-rw-r--r--activerecord/test/cases/scoping/named_scoping_test.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb
index 1db7432e34..b0431a4e34 100644
--- a/activerecord/test/cases/scoping/named_scoping_test.rb
+++ b/activerecord/test/cases/scoping/named_scoping_test.rb
@@ -117,7 +117,8 @@ class NamedScopingTest < ActiveRecord::TestCase
assert_not_equal Post.containing_the_letter_a, authors(:david).posts
assert !Post.containing_the_letter_a.empty?
- assert_equal authors(:david).posts & Post.containing_the_letter_a, authors(:david).posts.containing_the_letter_a
+ expected = authors(:david).posts & Post.containing_the_letter_a
+ assert_equal expected.sort_by(&:id), authors(:david).posts.containing_the_letter_a.sort_by(&:id)
end
def test_scope_with_STI
@@ -129,7 +130,8 @@ class NamedScopingTest < ActiveRecord::TestCase
assert_not_equal Comment.containing_the_letter_e, authors(:david).comments
assert !Comment.containing_the_letter_e.empty?
- assert_equal authors(:david).comments & Comment.containing_the_letter_e, authors(:david).comments.containing_the_letter_e
+ expected = authors(:david).comments & Comment.containing_the_letter_e
+ assert_equal expected.sort_by(&:id), authors(:david).comments.containing_the_letter_e.sort_by(&:id)
end
def test_scopes_honor_current_scopes_from_when_defined