Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement MatcherDelegator using the BlankSlate pattern
This allows to minimize the amount of method inherited by the delegator object, and protects RSpec from new methods being introduced by future Ruby versions or monkey patched in by user code or libraries. On modern Rubies there is `BasicObject` for this purpose, that's what `delegate.rb` uses for instance, and is considered best practice for delegators and other proxy objects. However since RSpec still support Ruby 1.8 so it's not an option. Additionally `BasicObject` doesn't inherit from `Object` so all constant resolutions in a `BasicObject` descendant must be fully qualified which is tedious, but more importantly changing this now would probably break third party code that inherit from `MatcherDelegator`.
- Loading branch information