Skip to content

Commit

Permalink
Fix random CI failure due to non-deterministic sorting order
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo authored and JesseChavez committed Dec 19, 2019
1 parent e9666fe commit 4abfcce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion activerecord/test/cases/finder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def test_find_by_ids_with_limit_and_offset
# limit of 3 and offset of 9, then you should find that there
# will be only 2 results, regardless of the limit.
devs = Developer.all
last_devs = Developer.limit(3).offset(9).find devs.map(&:id)
last_devs = Developer.limit(3).offset(9).find(devs.map(&:id).sort)
assert_equal 2, last_devs.size
assert_equal "fixture_10", last_devs[0].name
assert_equal "Jamis", last_devs[1].name
Expand Down
8 changes: 4 additions & 4 deletions activerecord/test/cases/relations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@ def test_finding_with_reversed_arel_assoc_order
end

def test_reverse_order_with_function
topics = Topic.order(Arel.sql("len(title)")).reverse_order
assert_equal topics(:second).title, topics.first.title
topics = Topic.order(Arel.sql("lower(title)")).reverse_order
assert_equal topics(:third).title, topics.first.title
end

def test_reverse_arel_assoc_order_with_function
topics = Topic.order(Arel.sql("len(title)") => :asc).reverse_order
assert_equal topics(:second).title, topics.first.title
topics = Topic.order(Arel.sql("lower(title)") => :asc).reverse_order
assert_equal topics(:third).title, topics.first.title
end

def test_reverse_order_with_function_other_predicates
Expand Down

0 comments on commit 4abfcce

Please sign in to comment.