rspec/rspec-mocks — pull request #474 by moro (2013-11-22 04:42:57+00:00)
Title: Stop inherited method's unrecoverble stub

Stubbing inherited method with `any_instance` sometimes cause
SystemStackError, below is reproduction example.

```ruby
class SuperClass
def foo; end
end

class SubClass < SuperClass
end

describe SubClass do
it "workds fine at firstt" do
SuperClass.any_instance.stub(:foo)
SubClass.any_instance.stub(:foo)
end

it "cause SystemStackError after removing stub" do
SubClass.new.foo # => SystemStackError raised
end
end
```
`restore_original_method` for SubClass restores SuperClass's stubbed method, so that `SubClass#foo` is broken.

This commit prevent this problem by raising error immediately when SubClass's `any_instance` stub is defined.