aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-27 19:23:46 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-27 19:23:46 +0900
commit44556a60c315ef4c927733e86f6ddef0a207a5cb (patch)
tree24f3a420901db7c834976ae93ab987320009b888 /activerecord/test/cases/scoping
parent1059dede4c4a1c042e3f4fe9f7fbfcc78146b233 (diff)
downloadrails-44556a60c315ef4c927733e86f6ddef0a207a5cb.tar.gz
rails-44556a60c315ef4c927733e86f6ddef0a207a5cb.tar.bz2
rails-44556a60c315ef4c927733e86f6ddef0a207a5cb.zip
Fix random CI failure due to non-deterministic sorting order
https://travis-ci.org/rails/rails/jobs/499061043#L1187-L1193
Diffstat (limited to 'activerecord/test/cases/scoping')
-rw-r--r--activerecord/test/cases/scoping/default_scoping_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb
index 6281712df6..b9e6f55eac 100644
--- a/activerecord/test/cases/scoping/default_scoping_test.rb
+++ b/activerecord/test/cases/scoping/default_scoping_test.rb
@@ -408,18 +408,18 @@ class DefaultScopingTest < ActiveRecord::TestCase
end
def test_joins_not_affected_by_scope_other_than_default_or_unscoped
- without_scope_on_post = Comment.joins(:post).to_a
+ without_scope_on_post = Comment.joins(:post).sort_by(&:id)
with_scope_on_post = nil
Post.where(id: [1, 5, 6]).scoping do
- with_scope_on_post = Comment.joins(:post).to_a
+ with_scope_on_post = Comment.joins(:post).sort_by(&:id)
end
- assert_equal with_scope_on_post, without_scope_on_post
+ assert_equal without_scope_on_post, with_scope_on_post
end
def test_unscoped_with_joins_should_not_have_default_scope
- assert_equal SpecialPostWithDefaultScope.unscoped { Comment.joins(:special_post_with_default_scope).to_a },
- Comment.joins(:post).to_a
+ assert_equal Comment.joins(:post).sort_by(&:id),
+ SpecialPostWithDefaultScope.unscoped { Comment.joins(:special_post_with_default_scope).sort_by(&:id) }
end
def test_sti_association_with_unscoped_not_affected_by_default_scope