From 2fd8a0f56f725d96d39562586812aecef3a8c0c9 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Fri, 24 Nov 2023 20:01:05 +0100 Subject: [PATCH] Test: filter out warnings from the mail gem These warnings are not relevant to the output, but dominate it. I borrowed the Warning example from the Ruby documentation. --- test/test_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 35a4d68..cf08b01 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -73,3 +73,16 @@ def run_check(name) # Swallow everything to be able to test erroring checks. self.error_handler = ->(error, context) {} end + +module TestRunWarningFilter + # Had some trouble with spurious warnings output in mail v2.8.1 gem. Ignore that, to focus output. + def warn(message, category: nil, **kwargs) + if %r{gems/mail-.+/lib/}.match?(message) + # ignore + else + super + end + end +end +Warning.extend TestRunWarningFilter +