I would like to test that instance of ChildClass calls something_interesting while omitting call to BaseClass.my_method
class BaseClass
def my_method *args, &block
end
end
class ChildClass < BaseClass
def my_method first_arg, second_arg
something_interesting
super first_arg, second_arg
end
end
If I write my test like this:
subject = ChildClass.new
subject.should_receive :something_interesting
BaseClass.any_instance.stub :my_method
subject.my_method
I get error:
ArgumentError: wrong number of arguments (3 for 2)
Any ideas why is that so? How to stub it out correctly?
You could stub
super: