Skip to content

Commit 6a7fae5

Browse files
authored
Merge pull request #976 from yellowspot/remove-deprecated-support-to-reorder-first
[Rails 7] Update test fo Model.reorder(nil).first usage
2 parents 0f49d25 + d6a5a8b commit 6a7fae5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

test/cases/coerced_tests.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,16 +1180,11 @@ def test_reorder_with_take_coerced
11801180
# We have implicit ordering, via FETCH.
11811181
coerce_tests! :test_reorder_with_first
11821182
def test_reorder_with_first_coerced
1183+
post = nil
11831184
sql_log = capture_sql do
1184-
message = <<~MSG.squish
1185-
`.reorder(nil)` with `.first` / `.first!` no longer
1186-
takes non-deterministic result in Rails 6.2.
1187-
To continue taking non-deterministic result, use `.take` / `.take!` instead.
1188-
MSG
1189-
assert_deprecated(message) do
1190-
assert Post.order(:title).reorder(nil).first
1191-
end
1185+
post = Post.order(:title).reorder(nil).first
11921186
end
1187+
assert_equal posts(:welcome), post
11931188
assert sql_log.none? { |sql| /order by [posts].[title]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}"
11941189
assert sql_log.all? { |sql| /order by \[posts\]\.\[id\]/i.match?(sql) }, "default ORDER BY ID was not used in the query: #{sql_log}"
11951190
end

0 commit comments

Comments
 (0)