Stubbing a method on any_instance_of(SomeModule) gives spurious error about prepended modules
Created by: afn
module Animal; def moo; end; end
class Cow; include Animal; end
expect_any_instance_of(Animal).to receive(:moo)
Raises:
Using `any_instance` to stub a method (moo) that has been defined on a prepended module (Animal) is not supported.
Should this:
prepended_modules = @klass.ancestors.take_while { |mod| !(Class === mod) }
stop when we encounter either a Class
or @klass
itself?