From 445fc85b59410c6d328086b699db5f91789c6dfe Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Fri, 16 Feb 2024 14:32:15 -0800 Subject: [PATCH] Fix test helper --- test/test_helper.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 86f36b62..ed5df3b8 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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