Skip to content

Commit b70947b

Browse files
authored
Merge pull request rails#45525 from sushantmittal/fix-flaky-test-cases
Fix flaky test cases in file 'activerecord/test/cases/relation/merging_test.rb'.
2 parents b3175b9 + c265974 commit b70947b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

activerecord/test/cases/relation/merging_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,16 @@ class MergingDifferentRelationsTest < ActiveRecord::TestCase
397397
test "merging relation with common table expression" do
398398
posts_with_tags = Post.with(posts_with_tags: Post.where("tags_count > 0")).from("posts_with_tags AS posts")
399399
posts_with_comments = Post.where("legacy_comments_count > 0")
400-
relation = posts_with_comments.merge(posts_with_tags)
400+
relation = posts_with_comments.merge(posts_with_tags).order("posts.id")
401401

402402
assert_equal [1, 2, 7], relation.pluck(:id)
403403
end
404404

405405
test "merging multiple relations with common table expression" do
406406
posts_with_tags = Post.with(posts_with_tags: Post.where("tags_count > 0"))
407407
posts_with_comments = Post.with(posts_with_comments: Post.where("legacy_comments_count > 0"))
408-
relation = posts_with_comments.merge(posts_with_tags).joins("JOIN posts_with_tags pwt ON pwt.id = posts.id JOIN posts_with_comments pwc ON pwc.id = posts.id")
408+
relation = posts_with_comments.merge(posts_with_tags)
409+
.joins("JOIN posts_with_tags pwt ON pwt.id = posts.id JOIN posts_with_comments pwc ON pwc.id = posts.id").order("posts.id")
409410

410411
assert_equal [1, 2, 7], relation.pluck(:id)
411412
end

0 commit comments

Comments
 (0)