freerange/mocha — pull request #194 by mrsimo (2014-03-06 18:41:08+00:00)
Title: Errors with stubbing prepended methods 

I have some code that used to use `alias_method_chain` and I hit the bug described in #184. I had a look at it and found out that since ruby 2.0 we can use `prepend` instead, so I refactored my code to do so. The tests then broke even worse!

If one stubs a method that was "prepended" (not sure what the correct word would be), it behaves incorrectly in two things:

* The stub is incorrect method returns "Bye World World" instead of "Hello World".
* After that (if you comment the `assert_equals` inside the `run_as_test`) the whole thing breaks with `NoMethodError: super: no superclass method 'my_method' for #<#Class:0x007ff6eac40a48>:0x007ff6eac489c8>`.

This happens with ruby 2.0 and 2.1

I'd like to try and solve this, but it's the first time I touch mocha and it doesn't seem trivial. If you can give any rough pointers they would be welcome. Otherwise please take this as a bug report instead :)