Skip to content

Add support for Ruby 3.4 and 4.0 - #29

Merged
rosston merged 6 commits into
mainfrom
more-ruby-versions
Sep 18, 2026
Merged

rosston merged 6 commits into
mainfrom
more-ruby-versions

Conversation

@rosston

@rosston rosston commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Supersedes #26

This is a large diff, but most of it is .rbi file updates.

In implementation code, the only things changed were matching both backtick (Ruby < 3.4) and single quote (Ruby >= 3.4) in in 'block' parts of backtraces.

@rosston
rosston added this pull request to stack #30 September 18, 2026 18:55
@rosston
rosston marked this pull request as ready for review September 18, 2026 19:11
Base automatically changed from bump-actions to main September 18, 2026 19:19
Ruby 3.4 changed backtrace frames from `` `method' `` to `` 'Class#method' ``.
Debug.guard_against_mocktail_accidentally_calling_mocks_if_debugging!
pattern-matched on the literal old backtick format to detect frames
inside a stubs { }.with { } block, so under Ruby 3.4+ it would
misidentify call sites and could raise a spurious "Unauthorized
internal call" error. Match either quote style instead.

Update explain_test.rb's hardcoded call-site expectations to match
the current Ruby's actual backtrace format rather than assuming the
pre-3.4 style.
Ruby 3.4 added __id__ to the set of methods it warns about when
redefined ("redefining '__id__' may cause serious problems"). This
test fixture already excludes __send__/object_id/nil?/is_a? for the
same reason; add __id__ to that list too.
minitest 5.25.5 and unicode-emoji 4.0.4 (locked, transitively via
unicode-display_width) both declare required_ruby_version excluding
Ruby 4.0 (`< 4.0`). Do a targeted `bundle update minitest
unicode-emoji --conservative` in each affected project rather than a
full re-lock, which wanted to jump simplecov 0.22->1.3 and tapioca
0.16->0.19 -- far more than this needs.

Pin minitest to "~> 5.26" everywhere it's declared so it can't drift
to the 6.0 line on a future update, since minitest 6.0+ requires
Ruby >= 3.2 and would break Ruby 3.1.
Add test/support/version_helper.rb (ported from #26) as a shared
place for that Ruby-version check, and use it in both
stringifies_call_test.rb and explain_test.rb.
CI on Ruby 4.0 was failing: `gem install bundler` (unpinned) grabs
whatever the latest bundler is, and on Ruby 4.0 that's the 4.x line,
which requires Ruby >= 3.2 and can't be used as the project's pinned
Bundler version without breaking Ruby 3.1. Using the older, pinned
Bundler (2.x, needed for 3.1 support) against Ruby 4.0's newer
built-in RubyGems triggers "already initialized constant
Gem::Platform::*" warnings on STDERR -- reproduced with a clean
`ruby:4.0` container and confirmed it isn't specific to any one
Bundler 2.6.x patch.

script/test_double_require_warnings asserted STDERR matched
Mocktail's warning message exactly, so this incidental noise broke
the assertion. Filter out lines matching Ruby's own
"path:line: warning: message" format before comparing, since
Mocktail's warning (emitted via plain `warn`) never has that prefix.
@rosston
rosston merged commit 2fc6425 into main Sep 18, 2026
10 checks passed
@rosston
rosston deleted the more-ruby-versions branch September 18, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant