1.4 KiB
| summary | tags | scope | date | |||
|---|---|---|---|---|---|---|
| Minitest 6 removed Minitest::Mock from core — require 'minitest/mock' raises LoadError; the API lives in the separate minitest-mock gem, and pinning minitest < 6 double-loads constants. |
|
global | 2026-07-16 |
Minitest 6 extracted Minitest::Mock from core
Under minitest 6.x (observed on 6.0.6, Ruby 4.0.2), require "minitest/mock" raises
LoadError: cannot load such file -- minitest/mock. The mock/stub API was extracted from
the core gem into a separate minitest-mock gem. Test suites written against minitest
5.x that use Minitest::Mock or Object#stub break on load once 6.x is the activated
version.
What doesn't work: pinning gem "minitest", "< 6" in a test helper. If minitest 6 is
already activated (it ships as a default gem), the pin loads 5.x alongside 6.x and floods
output with already initialized constant Minitest::VERSION / Runnable::SIGNALS warnings
— two versions' constants coexist.
Fixes, in order of preference:
- Add the
minitest-mockgem (Gemfile orgem install minitest-mock) — restores the oldrequire "minitest/mock"path. - Migrate the tests off
Minitest::Mock(hand-rolled fakes/stubs — often cleaner anyway).
Discovered 2026-07-16 while diagnosing a pre-existing failure in cc-plugins'
cc-architect test suite (test_runtime_verifier.rb, 6 errors).