Oh! I only realized now that my patch for rspec-mocks was merged 5 years ago: https://github.com/rspec/rspec-mocks/pull/1218

It's still in 4.0 beta though, no stable release yet 😬 https://github.com/rspec/rspec/blob/v4.0.0.beta1/rspec-mocks/Changelog.md#400beta1--2026-02-18

I understand it's considered a breaking change because it's fixing a "bug" that does change the behavior.

I am still pretty proud that most of the bugs I found in rspec mocks could not be reproduced in muack: https://github.com/godfat/muack

It's also pretty small, too! However it's fully feature complete.

Fix stubbing prepended only methods by godfat · Pull Request #1218 · rspec/rspec-mocks

Previously, we're assuming the method must be defined in the singleton class. However this is not always true. Whenever the method was only defined in the prepended module, then it's not de...

GitHub