Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is similar to the change in commit 8f58edd. Commit e87c03b made `ModuleMethod#method_exists?` redundant by changing the implementation of `ClassMethod#hide_original_method` so that it uses `ClassMethod#method_visibility` instead. This introduced a subtle change in behaviour due to the difference in `ModuleMethod#method_exists?` and `ClassMethod#method_visibility`. The former would return false if the method being stubbed was on `Kernel` or `Object` while the latter will return true in those cases. This gist illustrates the difference - https://gist.github.com/chrisroos/12a1b032b95664448c9e987132f33988. Practically, this meant that _some_ stubbed module methods (those defined on Kernel and Object) wouldn't have had the correct visibility set. The tests added in this commit ensure we don't introduce regressions in future. The tests for the visibility of the protected and private methods failed prior to commit e87c03b. I confirmed this by checking our the commit before that (`git co e87c03b~`) and running these new tests.
- Loading branch information