Skip to content

Commit

Permalink
Fix test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Feb 16, 2024
1 parent d1e53f7 commit 445fc85
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ def count_queries(**subscribe_opts, &block)
def assert_queries(num = 1, **subscribe_opts, &block)
log = []
ret = subscribe_to_sql_queries(->(sql) { log << sql }, **subscribe_opts, &block)
assert_equal(
num,
log.size,
<<~MSG.squish
#{log.size} instead of #{num} queries were executed.
#{log.empty? ? "" : "\nQueries:\n#{log.join("\n")}"}
MSG
)

msg = "#{log.size} instead of #{num} queries were executed."
msg << "\nQueries:\n#{log.join("\n")}" unless log.empty?

assert_equal(num, log.size, msg)
ret
end

Expand Down

0 comments on commit 445fc85

Please sign in to comment.