From aa84a783ee13d537fed26030455e21debe46ef61 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 17 Apr 2024 12:24:12 +0200 Subject: [PATCH] ruby-head: handle unused block warnings Ref: https://bugs.ruby-lang.org/issues/15554 This new Ruby 3.4 warning is still being fined tuned to reduce false positives, so we shouldn't fail builds on it just yet. It however caught one mistake in the test suite which is valuable. --- activesupport/lib/active_support/testing/strict_warnings.rb | 4 ++++ activesupport/test/time_travel_test.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/testing/strict_warnings.rb b/activesupport/lib/active_support/testing/strict_warnings.rb index 4b2098886a..5bc0e55952 100644 --- a/activesupport/lib/active_support/testing/strict_warnings.rb +++ b/activesupport/lib/active_support/testing/strict_warnings.rb @@ -12,6 +12,10 @@ module RaiseWarnings # :nodoc: # Expected non-verbose warning emitted by Rails. /Ignoring .*\.yml because it has expired/, /Failed to validate the schema cache because/, + + # Ref: https://bugs.ruby-lang.org/issues/15554 + # This new Ruby 3.4 warning is still being fined tuned to reduce false positives + /the block passed to/, ) SUPPRESSED_WARNINGS = Regexp.union( diff --git a/activesupport/test/time_travel_test.rb b/activesupport/test/time_travel_test.rb index 6dc0747a21..ec812bfdb1 100644 --- a/activesupport/test/time_travel_test.rb +++ b/activesupport/test/time_travel_test.rb @@ -332,11 +332,12 @@ def test_time_helper_with_usec_true def test_time_helper_freeze_time_with_usec_true # repeatedly test in case Time.now happened to actually be 0 usec - assert_predicate 9.times, :any? do + checks = 9.times.map do freeze_time(with_usec: true) do Time.now.usec != 0 end end + assert_predicate checks, :any? end def test_time_helper_travel_with_subsequent_block