Please sign in to comment.
Stubbing of methods re-declared with different visibilty. Fixes #109.
Given a method which is re-declared with a different visibility lower down the ancestor chain, and given we stub the "version" of the method that is lower down the ancestor chain, we should ensure it is restored to its original visibility when it is "unstubbed". This was highlighted in #109 where the FileUtils module in Ruby 2.0 declares the module-instance methods as private and then re-declares the module-class methods as public . Even though this bug was highlighted in Ruby 2.0, it can happen in Ruby 1.8 or 1.9 if methods are declared in the same way. We've added a new acceptance test to demonstrate the bug and fixed it. The fix is to store and restore the method visibility whether or not we remove the stubbed method. Note that in Ruby 1.8.7 there is a warning about re-defining the method, but we can't see an easy way around this at the moment.  ruby/ruby@ace4630#L1R161
- Loading branch information...
Showing with 27 additions and 7 deletions.