Compare commits

..

No commits in common. "rawhide" and "f42" have entirely different histories.

15 changed files with 606 additions and 269 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
/activesupport-*.gem
/activesupport-*-tests.tar.gz
/activesupport-*-tests.txz
/rails-*-tools.txz

View file

@ -0,0 +1,72 @@
From 9766eb4a833c26c64012230b96dd1157ebb8e8a2 Mon Sep 17 00:00:00 2001
From: eileencodes <eileencodes@gmail.com>
Date: Wed, 15 Jun 2022 12:44:11 -0400
Subject: [PATCH] Fix tests for minitest 5.16
In minitest/minitest@6e06ac9 minitest changed such that it now accepts
`kwargs` instead of requiring kwargs to be shoved into the args array.
This is a good change but required some updates to our test code to get
the new version of minitest passing.
Changes are as follows:
1) Lock minitest to 5.15 for Ruby 2.7. We don't love this change but
it's pretty difficult to get 2.7 and 3.0 to play nicely together with
the new kwargs changes. Dropping 2.7 support isn't an option right
now for Rails. This is safe because all of the code changes here are
internal methods to Rails like assert_called_with. Applications
shouldn't be consuming them as they are no-doc'd.
2) Update the `assert_called_with` method to take any kwargs but also
the returns kwarg.
3) Update callers of `assert_called_with` to move the kwargs outside the
args array.
4) Update the message from marshaled exceptions. In 5.16 the exception
message is "result not reported" instead of "Wrapped undumpable
exception".
Co-authored-by: Matthew Draper <matthew@trebex.net>
---
.../testing/method_call_assertions.rb | 22 +++-
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb
index 72451faaa8cc4..f146eefce0354 100644
--- a/activesupport/lib/active_support/testing/method_call_assertions.rb
+++ b/activesupport/lib/active_support/testing/method_call_assertions.rb
@@ -17,9 +17,9 @@ def assert_called(object, method_name, message = nil, times: 1, returns: nil, &b
assert_equal times, times_called, error
end
- def assert_called_with(object, method_name, args, returns: nil, &block)
+ def assert_called_with(object, method_name, args, returns: false, **kwargs, &block)
mock = Minitest::Mock.new
- mock.expect(:call, returns, args)
+ expect_called_with(mock, args, returns: returns, **kwargs)
object.stub(method_name, mock, &block)
@@ -30,6 +30,24 @@ def assert_not_called(object, method_name, message = nil, &block)
assert_called(object, method_name, message, times: 0, &block)
end
+ #--
+ # This method is a temporary wrapper for mock.expect as part of
+ # the Minitest 5.16 / Ruby 3.0 kwargs transition. It can go away
+ # when we drop support for Ruby 2.7.
+ if Minitest::Mock.instance_method(:expect).parameters.map(&:first).include?(:keyrest)
+ def expect_called_with(mock, args, returns: false, **kwargs)
+ mock.expect(:call, returns, args, **kwargs)
+ end
+ else
+ def expect_called_with(mock, args, returns: false, **kwargs)
+ if !kwargs.empty?
+ mock.expect(:call, returns, [*args, kwargs])
+ else
+ mock.expect(:call, returns, args)
+ end
+ end
+ end
+
def assert_called_on_instance_of(klass, method_name, message = nil, times: 1, returns: nil)
times_called = 0
klass.define_method("stubbed_#{method_name}") do |*|

View file

@ -0,0 +1,39 @@
From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001
From: John Crepezzi <john.crepezzi@gmail.com>
Date: Thu, 16 Jun 2022 08:34:05 -0400
Subject: [PATCH] Remove the multi-call form of assert_called_with
The `assert_called_with` helper allows passing a multi-dimensional array to
mock multiple calls to the same method for a given block. This works
fine now, but when adding support for real kwargs arguments to line up with
recent upgrades in Minitest, this approach is no longer workable because
we can't pass multiple sets of differing kwargs.
Rather than complicated this method further, this commit removes the
multi-call form of `assert_called_with` and modifies the tests that
currently make use of that functionality to just use the underlying
`Minitest::Mock` calls.
Co-authored-by: Eileen M. Uchitelle <eileencodes@gmail.com>
---
.../testing/method_call_assertions_test.rb | 7 --
1 file changed, 7 deletions(-)
diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb
index e75630d2e4228..4d59e0bd3c222 100644
--- a/activesupport/test/testing/method_call_assertions_test.rb
+++ b/activesupport/test/testing/method_call_assertions_test.rb
@@ -82,13 +82,6 @@ def test_assert_called_with_failure
end
end
- def test_assert_called_with_multiple_expected_arguments
- assert_called_with(@object, :<<, [ [ 1 ], [ 2 ] ]) do
- @object << 1
- @object << 2
- end
- end
-
def test_assert_called_on_instance_of_with_defaults_to_expect_once
assert_called_on_instance_of Level, :increment do
@object.increment

View file

@ -0,0 +1,39 @@
From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001
From: John Crepezzi <john.crepezzi@gmail.com>
Date: Thu, 16 Jun 2022 08:34:05 -0400
Subject: [PATCH] Remove the multi-call form of assert_called_with
The `assert_called_with` helper allows passing a multi-dimensional array to
mock multiple calls to the same method for a given block. This works
fine now, but when adding support for real kwargs arguments to line up with
recent upgrades in Minitest, this approach is no longer workable because
we can't pass multiple sets of differing kwargs.
Rather than complicated this method further, this commit removes the
multi-call form of `assert_called_with` and modifies the tests that
currently make use of that functionality to just use the underlying
`Minitest::Mock` calls.
Co-authored-by: Eileen M. Uchitelle <eileencodes@gmail.com>
---
.../testing/method_call_assertions.rb | 7 +-
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb
index c8d2dbaa52ab5..72451faaa8cc4 100644
--- a/activesupport/lib/active_support/testing/method_call_assertions.rb
+++ b/activesupport/lib/active_support/testing/method_call_assertions.rb
@@ -19,12 +19,7 @@ def assert_called(object, method_name, message = nil, times: 1, returns: nil, &b
def assert_called_with(object, method_name, args, returns: nil, &block)
mock = Minitest::Mock.new
-
- if args.all?(Array)
- args.each { |arg| mock.expect(:call, returns, arg) }
- else
- mock.expect(:call, returns, args)
- end
+ mock.expect(:call, returns, args)
object.stub(method_name, mock, &block)

View file

@ -0,0 +1,111 @@
From ca6995a80cb526958001e18d3b06da6587cd07eb Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Wed, 14 Feb 2024 09:52:55 +0100
Subject: [PATCH] Update Method#duplicable? to be consistent with Ruby 3.4
Fix: https://github.com/rails/rails/issues/51075
`Method` and `UnboundMethod` used to raise on `#dup`, but not `#clone`,
this wasn't so much a feature, but a bug.
It was fixed in https://github.com/ruby/ruby/pull/9926.
---
.../test/core_ext/object/duplicable_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
index 6fdf6d810ffb9..505455fe54bf3 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -28,23 +28,32 @@ def duplicable?
end
end
-class Method
- # Methods are not duplicable:
- #
- # method(:puts).duplicable? # => false
- # method(:puts).dup # => TypeError: allocator undefined for Method
- def duplicable?
- false
- end
+methods_are_duplicable = begin
+ Object.instance_method(:duplicable?).dup
+ true
+rescue TypeError
+ false
end
-class UnboundMethod
- # Unbound methods are not duplicable:
- #
- # method(:puts).unbind.duplicable? # => false
- # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
- def duplicable?
- false
+unless methods_are_duplicable
+ class Method
+ # Methods are not duplicable:
+ #
+ # method(:puts).duplicable? # => false
+ # method(:puts).dup # => TypeError: allocator undefined for Method
+ def duplicable?
+ false
+ end
+ end
+
+ class UnboundMethod
+ # Unbound methods are not duplicable:
+ #
+ # method(:puts).unbind.duplicable? # => false
+ # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
+ def duplicable?
+ false
+ end
end
end
diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb
index 07d9a3df4adc5..58de295719333 100644
--- a/activesupport/test/core_ext/object/duplicable_test.rb
+++ b/activesupport/test/core_ext/object/duplicable_test.rb
@@ -6,21 +6,26 @@
require "active_support/core_ext/numeric/time"
class DuplicableTest < ActiveSupport::TestCase
- RAISE_DUP = [method(:puts), method(:puts).unbind, Class.new.include(Singleton).instance]
- ALLOW_DUP = ["1", "symbol_from_string".to_sym, Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal("4.56"), nil, false, true, 1, 2.3, Complex(1), Rational(1)]
+ OBJECTS = [
+ method(:puts), method(:puts).unbind, Class.new.include(Singleton).instance,
+ "1", "symbol_from_string".to_sym, Object.new, /foo/, [], {}, Time.now, Class.new,
+ Module.new, BigDecimal("4.56"), nil, false, true, 1, 2.3, Complex(1), Rational(1),
+ ]
- def test_duplicable
- rubinius_skip "* Method#dup is allowed at the moment on Rubinius\n" \
- "* https://github.com/rubinius/rubinius/issues/3089"
-
- RAISE_DUP.each do |v|
- assert_not v.duplicable?, "#{ v.inspect } should not be duplicable"
- assert_raises(TypeError, v.class.name) { v.dup }
- end
+ OBJECTS.each do |v|
+ test "#{v.class}#duplicable? matches #{v.class}#dup behavior" do
+ duplicable = begin
+ v.dup
+ true
+ rescue TypeError
+ false
+ end
- ALLOW_DUP.each do |v|
- assert v.duplicable?, "#{ v.class } should be duplicable"
- assert_nothing_raised { v.dup }
+ if duplicable
+ assert_predicate v, :duplicable?
+ else
+ assert_not_predicate v, :duplicable?
+ end
end
end
end

View file

@ -0,0 +1,22 @@
From 6a7c72c078715380bf24f029624e6b1fb3035c97 Mon Sep 17 00:00:00 2001
From: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Date: Thu, 16 Jan 2025 11:17:29 +0200
Subject: [PATCH] Ensure the logger gem is loaded in Rails 7.0
Fix #54260, #54263
---
activesupport/lib/active_support/logger_thread_safe_level.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/activesupport/lib/active_support/logger_thread_safe_level.rb b/activesupport/lib/active_support/logger_thread_safe_level.rb
index 042f484f8210d..aa84a7c5de5c6 100644
--- a/activesupport/lib/active_support/logger_thread_safe_level.rb
+++ b/activesupport/lib/active_support/logger_thread_safe_level.rb
@@ -4,6 +4,7 @@
require "active_support/core_ext/module/attribute_accessors"
require "concurrent"
require "fiber"
+require "logger"
module ActiveSupport
module LoggerThreadSafeLevel # :nodoc:

View file

@ -0,0 +1,71 @@
From bcdeea5da7657375df21a856135ae7a66a8c3812 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Tue, 17 Oct 2023 17:46:48 +0200
Subject: [PATCH] Drop dependency on mutex_m
It used to be stdlib but is being extracted in modern rubies.
Overall its usefulness is dubious. In all cases it is included in
Rails, it's only for the `synchronize` method, but end up exposing
a dozen other useless methods.
In the end just using a Mutex is clearer and simpler.
In some cases we can even get away with a single mutex in a constant.
---
.../lib/active_support/notifications/fanout.rb | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index a84de150c0d63..2bc782ecee2cc 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "mutex_m"
require "concurrent/map"
require "set"
require "active_support/core_ext/object/try"
@@ -22,13 +21,11 @@ def iterate_guarding_exceptions(listeners)
#
# This class is thread safe. All methods are reentrant.
class Fanout
- include Mutex_m
-
def initialize
+ @mutex = Mutex.new
@string_subscribers = Hash.new { |h, k| h[k] = [] }
@other_subscribers = []
@listeners_for = Concurrent::Map.new
- super
end
def subscribe(pattern = nil, callable = nil, monotonic: false, &block)
@@ -33,7 +30,7 @@ def inspect # :nodoc:
def subscribe(pattern = nil, callable = nil, monotonic: false, &block)
subscriber = Subscribers.new(pattern, callable || block, monotonic)
- synchronize do
+ @mutex.synchronize do
case pattern
when String
@string_subscribers[pattern] << subscriber
@@ -49,7 +46,7 @@ def subscribe(pattern = nil, callable = nil, monotonic: false, &block)
end
def unsubscribe(subscriber_or_name)
- synchronize do
+ @mutex.synchronize do
case subscriber_or_name
when String
@string_subscribers[subscriber_or_name].clear
@@ -107,7 +104,7 @@ def publish_event(event)
def listeners_for(name)
# this is correctly done double-checked locking (Concurrent::Map's lookups have volatile semantics)
- @listeners_for[name] || synchronize do
+ @listeners_for[name] || @mutex.synchronize do
# use synchronisation when accessing @subscribers
@listeners_for[name] ||=
@string_subscribers[name] + @other_subscribers.select { |s| s.subscribed_to?(name) }

View file

@ -0,0 +1,139 @@
From 50daadaa71f4db88cef3080afde51e203c700e67 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Fri, 16 Feb 2024 09:53:45 +0100
Subject: [PATCH] Update test suite for compatibility with Ruby 3.4-dev
https://bugs.ruby-lang.org/issues/19117 and https://bugs.ruby-lang.org/issues/16495
slightly change how backtrace are rendered which makes a few tests fail.
---
activesupport/test/callbacks_test.rb | 57 ++++++++++-----
activesupport/test/core_ext/module_test.rb | 4 +-
.../test/core_ext/time_with_zone_test.rb | 2 +-
activesupport/test/test_case_test.rb | 4 +-
4 files changed, 45 insertions(+), 22 deletions(-)
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index 1083964eca0e7..b38da7a6acd5b 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -473,18 +473,33 @@ def test_tidy_call_stack
# callbacks that have been invoked, if there are any (plus
# whatever the callbacks do themselves, of course).
- assert_equal [
- "block in save",
- "block in run_callbacks",
- "tweedle_deedle",
- "block in run_callbacks",
- "w0tyes",
- "block in run_callbacks",
- "tweedle_dum",
- "block in run_callbacks",
- "run_callbacks",
- "save"
- ], call_stack.map(&:label)
+ if RUBY_VERSION >= "3.4"
+ assert_equal [
+ "block in CallbacksTest::MySlate#save",
+ "block in ActiveSupport::Callbacks#run_callbacks",
+ "CallbacksTest::AroundPerson#tweedle_deedle",
+ "block in ActiveSupport::Callbacks#run_callbacks",
+ "CallbacksTest::AroundPerson#w0tyes",
+ "block in ActiveSupport::Callbacks#run_callbacks",
+ "CallbacksTest::AroundPerson#tweedle_dum",
+ "block in ActiveSupport::Callbacks#run_callbacks",
+ "ActiveSupport::Callbacks#run_callbacks",
+ "CallbacksTest::MySlate#save",
+ ].join("\n"), call_stack.map(&:label).join("\n")
+ else
+ assert_equal [
+ "block in save",
+ "block in run_callbacks",
+ "tweedle_deedle",
+ "block in run_callbacks",
+ "w0tyes",
+ "block in run_callbacks",
+ "tweedle_dum",
+ "block in run_callbacks",
+ "run_callbacks",
+ "save",
+ ].join("\n"), call_stack.map(&:label).join("\n")
+ end
end
def test_short_call_stack
@@ -503,11 +518,19 @@ def test_short_call_stack
# there should be just one line. run_callbacks yields directly
# back to its caller.
- assert_equal [
- "block in save",
- "run_callbacks",
- "save"
- ], call_stack.map(&:label)
+ if RUBY_VERSION >= "3.4"
+ assert_equal [
+ "block in CallbacksTest::Person#save",
+ "ActiveSupport::Callbacks#run_callbacks",
+ "CallbacksTest::Person#save",
+ ].join("\n"), call_stack.map(&:label).join("\n")
+ else
+ assert_equal [
+ "block in save",
+ "run_callbacks",
+ "save",
+ ].join("\n"), call_stack.map(&:label).join("\n")
+ end
end
end
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index d5899c646ab8b..23fee4bf125cd 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -394,7 +394,7 @@ def test_delegate_missing_to_does_not_delegate_to_private_methods
DecoratedReserved.new(@david).private_name
end
- assert_match(/undefined method `private_name' for/, e.message)
+ assert_match(/undefined method [`']private_name' for/, e.message)
end
def test_delegate_missing_to_does_not_delegate_to_fake_methods
@@ -402,7 +402,7 @@ def test_delegate_missing_to_does_not_delegate_to_fake_methods
DecoratedReserved.new(@david).my_fake_method
end
- assert_match(/undefined method `my_fake_method' for/, e.message)
+ assert_match(/undefined method [`']my_fake_method' for/, e.message)
end
def test_delegate_missing_to_raises_delegation_error_if_target_nil
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index ff4170dd82875..19fc50087809c 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -1113,7 +1113,7 @@ def test_no_method_error_has_proper_context
e = assert_raises(NoMethodError) {
@twz.this_method_does_not_exist
}
- assert_match(/undefined method `this_method_does_not_exist' for.*ActiveSupport::TimeWithZone/, e.message)
+ assert_match(/undefined method [`']this_method_does_not_exist' for.*ActiveSupport::TimeWithZone/, e.message)
assert_no_match "rescue", e.backtrace.first
end
end
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb
index dc2c2772996d7..05f1280790f3b 100644
--- a/activesupport/test/test_case_test.rb
+++ b/activesupport/test/test_case_test.rb
@@ -391,8 +391,8 @@ def test_fails_and_warning_is_logged_if_wrong_error_caught
Other block based assertions (e.g. `assert_no_changes`) can be used, as long as `assert_raises` is inside their block.
MSG
assert @out.string.include?(expected), @out.string
- assert error.message.include?("ArgumentError: ArgumentError")
- assert error.message.include?("in `block (2 levels) in run_test_that_should_fail_confusingly'")
+ assert_includes error.message, "ArgumentError: ArgumentError"
+ assert_includes error.message, "run_test_that_should_fail_confusingly"
end
private

View file

@ -0,0 +1,24 @@
From 95c2ee8e0503215ad94629383311301742ebf012 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Sat, 5 Oct 2024 12:25:51 -0400
Subject: [PATCH] Update Active Support test suite for Ruby 3.4 Hash#inspect
Ref: https://github.com/ruby/ruby/pull/10924
Ref: https://bugs.ruby-lang.org/issues/20433
---
activesupport/test/broadcast_logger_test.rb | 4 ++--
activesupport/test/ordered_options_test.rb | 18 +++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/activesupport/test/ordered_options_test.rb b/activesupport/test/ordered_options_test.rb
index 8eca0fe73bec7..eb8b50c62f511 100644
--- a/activesupport/test/ordered_options_test.rb
+++ b/activesupport/test/ordered_options_test.rb
@@ -123,6 +123,6 @@ def test_inspect
a.foo = :bar
a[:baz] = :quz
- assert_equal "#<ActiveSupport::OrderedOptions {:foo=>:bar, :baz=>:quz}>", a.inspect
+ assert_equal "#<ActiveSupport::OrderedOptions #{{ foo: :bar, baz: :quz }}>", a.inspect
end
end

View file

@ -1,24 +0,0 @@
From 283d96ea53f45eedf09a31bef739575df96e87df Mon Sep 17 00:00:00 2001
From: zzak <zzak@hey.com>
Date: Sun, 5 Oct 2025 10:31:09 +0900
Subject: [PATCH] Always pass default precision to BigDecimal when parsing
Float in XmlMini
https://github.com/ruby/bigdecimal/blob/cb2458bde33bf90a8364b58d53e8948a7ba555ea/ext/bigdecimal/bigdecimal.c#L2747-L2749
---
activesupport/lib/active_support/xml_mini.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
index 2c2b8185b1b80..c6d7ce5b7c251 100644
--- a/activesupport/lib/active_support/xml_mini.rb
+++ b/activesupport/lib/active_support/xml_mini.rb
@@ -74,6 +74,8 @@ def content_type
"decimal" => Proc.new do |number|
if String === number
number.to_d
+ elsif Float === number
+ BigDecimal(number, 0)
else
BigDecimal(number)
end

View file

@ -1,12 +0,0 @@
--- activesupport-8.0.3/lib/active_support/testing/autorun.rb.orig 2025-12-30 16:47:16.780346179 +0900
+++ activesupport-8.0.3/lib/active_support/testing/autorun.rb 2025-12-30 16:52:01.482400639 +0900
@@ -8,5 +8,8 @@ require "minitest"
# used in some cases. This conditional can probably go after the bump
# is complete? ... but could still fail for developers working w/
# multiple versions installed.
-Minitest.load :rails if Minitest.respond_to? :load
+begin
+ Minitest.load :rails if Minitest.respond_to? :load
+rescue LoadError
+end
Minitest.autorun

View file

@ -1,129 +0,0 @@
From 9da4460ad0e71e5c3de32566ffbc302674b1f76e Mon Sep 17 00:00:00 2001
From: Ryan Davis <ryand-ruby@zenspider.com>
Date: Thu, 20 Nov 2025 12:50:33 -0800
Subject: [PATCH 1/5] MT6: Load rails plugin
---
activesupport/lib/active_support/testing/autorun.rb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/activesupport/lib/active_support/testing/autorun.rb b/activesupport/lib/active_support/testing/autorun.rb
index d5d5fc7ae8e45..068aac0b487e0 100644
--- a/activesupport/lib/active_support/testing/autorun.rb
+++ b/activesupport/lib/active_support/testing/autorun.rb
@@ -2,4 +2,11 @@
require "minitest"
+##
+# I shouldn't need this respond_to check but some tests are running
+# sub-process tests in an unbundled environment, causing MT5 to be
+# used in some cases. This conditional can probably go after the bump
+# is complete? ... but could still fail for developers working w/
+# multiple versions installed.
+Minitest.load :rails if Minitest.respond_to? :load
Minitest.autorun
From 831f0f96d0f9c132b28d3fa22ab82806115747b0 Mon Sep 17 00:00:00 2001
From: Ryan Davis <ryand-ruby@zenspider.com>
Date: Thu, 20 Nov 2025 14:16:51 -0800
Subject: [PATCH 3/5] MT6: implementation fixes
MT6 changes the way assertion messages work. Now, if a proc is passed
in for the message, it wins untouched. So for the rails assertions
that want to have diffs shown while calling assert_equal with a
message proc, the proc needs to call diff itself. This feels redundant
to me, but not my call.
And since the procs win now, they need to provide their own periods at
the end of the text.
---
activesupport/lib/active_support/testing/assertions.rb | 8 +++++---
.../lib/active_support/testing/parallelization/worker.rb | 6 +++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb
index 178b5b350abba..4f2c6b105bc19 100644
--- a/activesupport/lib/active_support/testing/assertions.rb
+++ b/activesupport/lib/active_support/testing/assertions.rb
@@ -124,7 +124,8 @@ def assert_difference(expression, *args, &block)
actual = exp.call
rich_message = -> do
code_string = code.respond_to?(:call) ? _callable_to_source_string(code) : code
- error = "`#{code_string}` didn't change by #{diff}, but by #{actual - before_value}"
+ error = "`#{code_string}` didn't change by #{diff}, but by #{actual - before_value}."
+ error = "#{error}\n#{diff before_value + diff, actual}" if Minitest::VERSION > "6"
error = "#{message}.\n#{error}" if message
error
end
@@ -228,7 +229,7 @@ def assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &b
rich_message = -> do
code_string = expression.respond_to?(:call) ? _callable_to_source_string(expression) : expression
error = "`#{code_string}` didn't change"
- error = "#{error}. It was already #{to.inspect}" if before == to
+ error = "#{error}. It was already #{to.inspect}." if before == to
error = "#{message}.\n#{error}" if message
error
end
@@ -296,8 +297,9 @@ def assert_no_changes(expression, message = nil, from: UNTRACKED, &block)
rich_message = -> do
code_string = expression.respond_to?(:call) ? _callable_to_source_string(expression) : expression
- error = "`#{code_string}` changed"
+ error = "`#{code_string}` changed."
error = "#{message}.\n#{error}" if message
+ error = "#{error}\n#{diff before, after}" if Minitest::VERSION > "6"
error
end
diff --git a/activesupport/lib/active_support/testing/parallelization/worker.rb b/activesupport/lib/active_support/testing/parallelization/worker.rb
index d008277f8924c..daad6ce659103 100644
--- a/activesupport/lib/active_support/testing/parallelization/worker.rb
+++ b/activesupport/lib/active_support/testing/parallelization/worker.rb
@@ -49,7 +49,11 @@ def perform_job(job)
set_process_title("#{klass}##{method}")
result = klass.with_info_handler reporter do
- Minitest.run_one_method(klass, method)
+ if Minitest.respond_to?(:run_one_method) then
+ Minitest.run_one_method(klass, method)
+ else
+ klass.new(method).run
+ end
end
safe_record(reporter, result)
From 2c1ca03402de9a5bc4e482da739e39f5bd47f0b3 Mon Sep 17 00:00:00 2001
From: Ryan Davis <ryand-ruby@zenspider.com>
Date: Thu, 20 Nov 2025 15:34:55 -0800
Subject: [PATCH 4/5] MT6: test fixes
Mostly minor and mostly centered around whether there are diffs.
---
actionpack/test/dispatch/routing/route_set_test.rb | 4 ++--
activesupport/test/test_case_test.rb | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb
index 7e5084e4b041c..05ed8f2ae629d 100644
--- a/activesupport/test/test_case_test.rb
+++ b/activesupport/test/test_case_test.rb
@@ -243,7 +243,7 @@ def test_assert_changes_with_to_option_but_no_change_has_special_message
end
end
- assert_equal "`@object.num` didn't change. It was already 0.\nExpected 0 to not be equal to 0.", error.message
+ assert_match "`@object.num` didn't change. It was already 0.", error.message
end
def test_assert_changes_message_with_lambda
@@ -255,7 +255,7 @@ def test_assert_changes_message_with_lambda
end
end
- assert_equal "`@object.num` didn't change. It was already 0.\nExpected 0 to not be equal to 0.", error.message
+ assert_match "`@object.num` didn't change. It was already 0.", error.message
end
def test_assert_changes_with_wrong_to_option

View file

@ -4,26 +4,43 @@
Name: rubygem-%{gem_name}
Epoch: 1
Version: 8.0.3
Release: 4%{?dist}
Version: 7.0.8
Release: 11%{?dist}
Summary: A support libraries and Ruby core extensions extracted from the Rails framework
License: MIT
URL: https://rubyonrails.org
URL: http://rubyonrails.org
Source0: https://rubygems.org/gems/%{gem_name}-%{version}%{?prerelease}.gem
# git clone http://github.com/rails/rails.git && cd rails/activesupport
# git archive -v -o activesupport-8.0.3-tests.tar.gz v8.0.3 test/
Source1: %{gem_name}-%{version}%{?prerelease}-tests.tar.gz
# This is needed due to `force_skip` alias.
# https://github.com/rails/rails/blob/main/tools/test_common.rb
Source2: https://raw.githubusercontent.com/rails/rails/e25d738430bdc6bdd04cd28be705484ea953e74e/tools/test_common.rb
# Fix XmlMiniTest::ParsingTest#test_decimal test failure with BigDecimal 3.2.3+
# https://github.com/rails/rails/pull/55840
Patch1: rubygem-activesupport-8.0.3-Always-pass-default-precision-to-BigDecimal-when-parsing.patch
# Support minitest 6
# https://github.com/rails/rails/pull/56202/
Patch2: rubygem-activesupport-pr56202-minitest6.patch
# We don't always install railties with activesupport, so rescue this
Patch3: rubygem-activesupport-pr56202-minitest6-rescue-loaderror.patch
# The activesupport gem doesn't ship with the test suite.
# You may check it out like so
# git clone http://github.com/rails/rails.git
# cd rails/activesupport && git archive -v -o activesupport-7.0.8-tests.txz v7.0.8 test/
Source1: %{gem_name}-%{version}%{?prerelease}-tests.txz
# The tools are needed for the test suite, are however unpackaged in gem file.
# You may get them like so
# git clone http://github.com/rails/rails.git --no-checkout
# cd rails && git archive -v -o rails-7.0.8-tools.txz v7.0.8 tools/
Source2: rails-%{version}%{?prerelease}-tools.txz
# Fixes for Minitest 5.16+
# https://github.com/rails/rails/pull/45380
Patch1: rubygem-activesupport-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch
Patch2: rubygem-activesupport-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with-test.patch
# https://github.com/rails/rails/pull/45370
Patch3: rubygem-activesupport-7.0.2.3-Fix-tests-for-minitest-5.16.patch
# https://github.com/rails/rails/pull/51079
Patch4: rubygem-activesupport-7.0.2.3-update-method_duplicable.patch
# Drop mutex_m dependency to ease Ruby 3.4 compatibility.
# https://github.com/rails/rails/pull/49674
Patch5: rubygem-activesupport-7.2.0-Drop-dependency-on-mutex-m.patch
# Ruby 3.4 backtrace compatibility.
# https://github.com/rails/rails/pull/51101
Patch6: rubygem-activesupport-7.2.0-Update-test-suite-for-compatibility-with-Ruby-3-4-dev.patch
# Ruby 3.4 `Hash#inspect` compatibility.
# https://github.com/rails/rails/commit/95c2ee8e0503215ad94629383311301742ebf012
Patch7: rubygem-activesupport-8.0.0-Update-Active-Support-test-suite-for-Ruby-3-4-Hash-inspect.patch
# concurrent-ruby 1.3.5+ drops Logger dependency. Make sure to load Logger
# explicitly.
# https://github.com/rails/rails/pull/54264
Patch8: rubygem-activesupport-7.0.8-Ensure-the-logger-gem-is-loaded-in-Rails-7-0.patch
# Ruby package has just soft dependency on rubygem(json), while
# ActiveSupport always requires it.
@ -36,35 +53,30 @@ Requires: tzdata
# Let's keep Requires and BuildRequires sorted alphabeticaly
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 3.2.0
BuildRequires: ruby >= 2.2.2
BuildRequires: rubygem(bigdecimal)
BuildRequires: rubygem(builder)
BuildRequires: rubygem(concurrent-ruby)
BuildRequires: rubygem(connection_pool)
BuildRequires: rubygem(dalli)
BuildRequires: rubygem(drb)
BuildRequires: rubygem(i18n) >= 0.7
BuildRequires: rubygem(listen)
BuildRequires: (rubygem(i18n) >= 0.7 with rubygem(i18n) < 2)
BuildRequires: rubygem(minitest) >= 5.0.0
BuildRequires: rubygem(minitest-mock)
BuildRequires: rubygem(msgpack)
BuildRequires: rubygem(rack)
BuildRequires: rubygem(tzinfo) >= 2.0
BuildRequires: rubygem(listen)
BuildRequires: rubygem(redis)
BuildRequires: rubygem(rexml)
BuildRequires: rubygem(tzinfo) >= 2.0
BuildRequires: memcached
%ifnarch %{ix86}
BuildRequires: %{_bindir}/valkey-server
%endif
BuildRequires: tzdata
BuildArch: noarch
%description
A toolkit of support libraries and Ruby core extensions extracted from the
Rails framework. Rich support for multibyte strings, internationalization,
time zones, and testing.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
@ -74,15 +86,32 @@ BuildArch: noarch
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}%{?prerelease} -a 1
%setup -q -n %{gem_name}-%{version}%{?prerelease} -b1 -b2
%patch 1 -p2
%patch 2 -p2
%patch 3 -p1
%patch 3 -p2
mv %{_builddir}/test .
%patch 4 -p2
mv test %{_builddir}
%patch 5 -p2
%patch 8 -p2
# lib/active_support/testing/method_call_assertions.rb
# always needs minitest/mock
%gemspec_add_dep -g minitest-mock
pushd %{_builddir}
%patch 2 -p2
%patch 6 -p2
%patch 7 -p2
popd
# Add several dependencies to avoid Ruby 3.3+ warnings.
# https://github.com/rails/rails/commit/81699b52d2acff1840e3ace5e59412f4fa3934ab
%gemspec_add_dep -g base64
%gemspec_add_dep -g drb
# https://github.com/rails/rails/commit/a77535c74c7047a517cc45ff8ecb416ea439c28d
%gemspec_add_dep -g bigdecimal
# https://github.com/rails/rails/commit/455b5f106e5a3eeba1e7139c63fd83dc0dd81caf
%gemspec_add_dep -g logger
%gemspec_add_dep -g securerandom
%gemspec_add_dep -g benchmark
%build
gem build ../%{gem_name}-%{version}%{?prerelease}.gemspec
@ -94,43 +123,39 @@ cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
# Move the tests into place
cp -a test .%{gem_instdir}
ln -s %{_builddir}/tools ..
cp -a %{_builddir}/test .
cd .%{gem_instdir}
# These tests are really unstable, but they seems to be passing upstream :/
# mem_cache_store_test: These tests do not pass in Koji; but work locally
# redis_cache_store_test: failed to require "redis/connection/hiredis"
for f in \
test/evented_file_update_checker_test.rb \
test/cache/stores/redis_cache_store_test.rb \
test/cache/stores/mem_cache_store_test.rb
do
mv $f{,.disable}
done
mkdir ../tools
ln -s %{SOURCE2} ../tools/
touch ../tools/strict_warnings.rb
# This seems to be unstable as well ...
# https://github.com/rails/rails/issues/25682
sed -i '/def test_iso8601_output_and_reparsing$/,/^ end$/ s/^/#/' test/core_ext/duration_test.rb
# Workaround TransformValuesTest#test_default_procs_do_not_persist_*_mapping
# test failures due to bug in Ruby 2.7.{0,1}.
# https://bugs.ruby-lang.org/issues/16498
sed -i '/assert_nil mapped\[:b\]/ s/^/#/' test/core_ext/hash/transform_values_test.rb
sed -i '/require .bundler./ s/^/#/' test/abstract_unit.rb
# backported from:
# https://github.com/rails/rails/commit/632b2c5128581731c2451459081176a43f474f74
# benchmark 0.5.0 in ruby4_0 defines Benchmark.ms{}, so the following
# test is no longer needed
sed -i test/core_ext/benchmark_test.rb -e '\@test_is_deprecated@s@$@ ; skip ""@'
# Start a testing Valkey (Redis) server instance
%ifnarch %{ix86}
VALKEY_DIR=$(mktemp -d)
valkey-server --dir $VALKEY_DIR --pidfile $VALKEY_DIR/valkey.pid --daemonize yes
%endif
# Start Memcached server
memcached &
mPID=$!
sleep 1
ruby -Ilib -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' -- -v
# Shutdown Memcached
ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
kill -15 $mPID
# Shutdown Valkey.
%ifnarch %{ix86}
kill -INT $(cat $VALKEY_DIR/valkey.pid)
%endif
popd
%files
%dir %{gem_instdir}
@ -145,27 +170,6 @@ kill -INT $(cat $VALKEY_DIR/valkey.pid)
%doc %{gem_instdir}/README.rdoc
%changelog
* Tue Dec 30 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1:8.0.3-4
- Update minitest 6 patch, and rescue when railties is not installed
* Mon Dec 29 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1:8.0.3-3
- Backport upstream fix to support minitest 6
* Sun Nov 09 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1:8.0.3-2
- Backport upstream change for testsuite removal for new benchmark gem in
ruby4_0
* Mon Oct 06 2025 Vít Ondruch <vondruch@redhat.com> - 1:8.0.3-1
- Update to Active Support 8.0.3.
Related: rhzb#2388437
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1:8.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Wed Jul 02 2025 Vít Ondruch <vondruch@redhat.com> - 1:8.0.2-1
- Update to Active Support 8.0.2.
Related: rhbz#2238177
* Thu Jan 23 2025 Vít Ondruch <vondruch@redhat.com> - 1:7.0.8-11
- Fix compatibility with concurrent-ruby 1.3.5+

View file

@ -1,2 +1,3 @@
SHA512 (activesupport-8.0.3-tests.tar.gz) = d11560cc2246aaa16fcb7f213061cb6a355bd2e4bbc0cd3e0541db979aa90d28b738ceaf36935f49688953faf94314e2ae8da3e2f88436ac31c0a77a5804a91e
SHA512 (activesupport-8.0.3.gem) = f46b6710c65d7b59e0c7f1eb48641aa4ef0568b2d64147866e1dfa699c0b4c068bf443cc9967190ed47c2f6ea98137668a300455792982061e280a7df605bb4f
SHA512 (activesupport-7.0.8.gem) = d3f45452751a3ff4acd534ad6a71e5747d2e64683b562b99c3f97ca3980424aa0093d028fab94a6429410fb4878c6e34a2af2ad8c0c04358648e180a732250dc
SHA512 (activesupport-7.0.8-tests.txz) = 153739dca3cd20938e7f1bb255d330e51e91fb9901b6b2ff5ffd76277e44e38090b1037f9eeb574d8ef429c1d3d689dbeb27b9d02ff33fe8f21cef2472a2e8b2
SHA512 (rails-7.0.8-tools.txz) = a67b43ecabe47d23bd437651c97c87e1323dc2eb20d0fffa2c8f0d75fae7502571c3a2633c5bdeb9cc4a383c88b5eade49d55efe895857285b3186b6d4da4b26

View file

@ -1,20 +0,0 @@
# frozen_string_literal: true
ActiveSupport::TestCase.alias_method :force_skip, :skip
if ENV["BUILDKITE"]
require "minitest-ci"
ENV.delete("CI") # CI has affect on the applications, and we don't want it applied to the apps.
Minitest::Ci.report_dir = File.join(__dir__, "../test-reports/#{ENV['BUILDKITE_JOB_ID']}")
module DisableSkipping # :nodoc:
private
def skip(message = nil, *)
flunk "Skipping tests is not allowed in this environment (#{message})\n" \
"Tests should only be skipped when the environment is missing a required dependency.\n" \
"This should never happen on CI."
end
end
ActiveSupport::TestCase.include(DisableSkipping)
end