From 8d77453a9c192e38564e58ac5bf8cd407a84c443 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Tue, 4 Nov 2025 10:02:10 +0100 Subject: [PATCH] Declare `required_ruby_version` to be Ruby 3.1 This is only documented in the Readme. 3.0.0 now depends on pattern matching, which is invalid syntax on 2.7. The `test-unit` gem depends on `power_assert` and tries to handle that by catching `SyntaxError`: https://github.com/test-unit/test-unit/blob/edfa50cf4fef5521f34dca1995c1c8f3efe77d7b/lib/test/unit/assertions.rb#L12-L18 That seems to have worked ok previously but now it leaves the `PowerAssert` module behind, among other things. `test-unit` cleans that up via https://github.com/test-unit/test-unit/pull/329 but there are other side-effects it can do nothing about. For example, an undefined `new` method: > /Users/runner/hostedtoolcache/Ruby/2.7.8/arm64/lib/ruby/gems/2.7.0/gems/onigmo-0.1.0/lib/onigmo/node.rb:27:in `private_class_method': undefined method `new' for class `#' (NameError) > Did you mean? next Now, bundler will always fall back to 3.0.0 even if this gets released as 3.0.0. But eventually it will help for future version bumps. --- power_assert.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/power_assert.gemspec b/power_assert.gemspec index e4ca2ef..6c5a30a 100644 --- a/power_assert.gemspec +++ b/power_assert.gemspec @@ -12,6 +12,7 @@ Gem::Specification.new do |s| s.summary = "Power Assert for Ruby" s.description = "Power Assert shows each value of variables and method calls in the expression. It is useful for testing, providing which value wasn't correct when the condition is not satisfied." + s.required_ruby_version = '>= 3.1.0' s.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{\A(?:test|spec|features|benchmark|bin)/}) end