ruby: use inline expectation tests

This commit is contained in:
yoff
2025-02-11 12:51:25 +01:00
parent 921104306a
commit 0912e3b024
2 changed files with 5 additions and 4 deletions

View File

@@ -1 +1,2 @@
queries/performance/DatabaseQueryInLoop.ql
query: queries/performance/DatabaseQueryInLoop.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -8,15 +8,15 @@ class DatabaseQueryInLoopTest
# simple query in loop
names.map do |name|
User.where(login: name).pluck(:id).first
User.where(login: name).pluck(:id).first # $ Alert
end
# nested loop
names.map do |name|
user = User.where(login: name).pluck(:id).first
user = User.where(login: name).pluck(:id).first # $ Alert
ids.map do |user_id|
User.where(id: user_id).pluck(:id).first
User.where(id: user_id).pluck(:id).first # $ Alert
end
end