Backport of #722

https://github.com/rspec/rspec-mocks/pull/722