Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky tests without guaranteed sort #48580

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def test_building_the_associated_object_with_an_unrelated_type

speedometer.reload

assert_equal ["first", "second"], speedometer.minivans.map(&:name)
assert_equal ["first", "second"], speedometer.minivans.map(&:name).sort
assert_equal ["blue", "blue"], speedometer.minivans.map(&:color)
end

Expand All @@ -402,7 +402,7 @@ def test_building_the_associated_object_with_an_unrelated_type

speedometer.reload

assert_equal ["first", "second"], speedometer.minivans.map(&:name)
assert_equal ["first", "second"], speedometer.minivans.map(&:name).sort
assert_equal ["blue", "blue"], speedometer.minivans.map(&:color)
end

Expand All @@ -415,7 +415,7 @@ def test_building_the_associated_object_with_an_unrelated_type

speedometer.reload

assert_equal ["first", "second"], speedometer.minivans.map(&:name)
assert_equal ["first", "second"], speedometer.minivans.map(&:name).sort
assert_equal ["blue", "blue"], speedometer.minivans.map(&:color)
end

Expand All @@ -428,7 +428,7 @@ def test_building_the_associated_object_with_an_unrelated_type

speedometer.reload

assert_equal ["first", "second"], speedometer.minivans.map(&:name)
assert_equal ["first", "second"], speedometer.minivans.map(&:name).sort
assert_equal ["blue", "blue"], speedometer.minivans.map(&:color)
end

Expand Down Expand Up @@ -3113,7 +3113,7 @@ def test_ids_reader_memoization

bulb2 = car.bulbs.create!

assert_equal [bulb.id, bulb2.id], car.bulb_ids
assert_equal [bulb.id, bulb2.id], car.bulb_ids.sort
assert_no_queries { car.bulb_ids }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def test_empty_on_disable_joins_through_using_custom_foreign_key
end

def test_pluck_on_disable_joins_through_a_through
rating_ids = Rating.where(comment: @comment).pluck(:id)
assert_equal rating_ids, assert_queries(1) { @author.ratings.pluck(:id) }
assert_equal rating_ids, assert_queries(3) { @author.no_joins_ratings.pluck(:id) }
rating_ids = Rating.where(comment: @comment).pluck(:id).sort
assert_equal rating_ids, assert_queries(1) { @author.ratings.pluck(:id).sort }
assert_equal rating_ids, assert_queries(3) { @author.no_joins_ratings.pluck(:id).sort }
end

def test_count_on_disable_joins_through_a_through
Expand Down