diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb index fbab62b7b6f4b..8254111fe747d 100644 --- a/activesupport/lib/active_support/testing/time_helpers.rb +++ b/activesupport/lib/active_support/testing/time_helpers.rb @@ -11,7 +11,9 @@ class SimpleStubs # :nodoc: Stub = Struct.new(:object, :method_name, :original_method) def initialize - @stubs = Concurrent::Map.new { |h, k| h[k] = {} } + @stubs = Concurrent::Map.new do |h, k| + h.compute_if_absent(k) { {} } + end end # Stubs object.method_name with the given block