From e02710191e9e0102b35cd0d418ec155598b6d461 Mon Sep 17 00:00:00 2001 From: Hartley McGuire Date: Thu, 23 Feb 2023 17:07:34 -0500 Subject: [PATCH] Suppress output from mail parser warnings Previously, requiring any of the ragel generated parsers in mail would output tons of warnings in tests, making output much harder to read (especially in Railties). This commit extends the RaiseWarnings patch to suppress output from these mail parsers. The suppression can be removed once mikel/mail#1557 or mikel/mail#1551 or any other PR fixes the issue --- .../lib/active_support/testing/strict_warnings.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/activesupport/lib/active_support/testing/strict_warnings.rb b/activesupport/lib/active_support/testing/strict_warnings.rb index 9063960c1ef26..e25e06077d222 100644 --- a/activesupport/lib/active_support/testing/strict_warnings.rb +++ b/activesupport/lib/active_support/testing/strict_warnings.rb @@ -12,7 +12,16 @@ module RaiseWarnings /Ignoring .*\.yml because it has expired/, /Failed to validate the schema cache because/, ) + + SUPPRESSED_WARNINGS = Regexp.union( + # TODO: remove if https://github.com/mikel/mail/pull/1557 or similar fix + %r{/lib/mail/parsers/.*statement not reached}, + %r{/lib/mail/parsers/.*assigned but unused variable - testEof} + ) + def warn(message, *) + return if SUPPRESSED_WARNINGS.match?(message) + super return unless message.include?(PROJECT_ROOT)