Fail CI on unknown deprecation warnings

This commit is contained in:
Maikel Linke
2025-03-28 14:59:32 +11:00
parent 9e1a66c1e5
commit db513470e0

View File

@@ -52,7 +52,18 @@ Openfoodnetwork::Application.configure do
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# config.active_support.deprecation = :stderr
# Fail tests on deprecated code unless it's a known case to solve.
ActiveSupport::Deprecation.behavior = ->(message, callstack, deprecation_horizon, gem_name) do
allowed_warnings = [
# List strings here to allow matching deprecations.
"Enumerable.sum", # spec/lib/reports/bulk_coop_report_spec.rb:188
]
unless allowed_warnings.any? { |pattern| message.match(pattern) }
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:raise].call(message, callstack, deprecation_horizon, gem_name)
end
end
config.active_job.queue_adapter = :test
end