[rspec-users] Stubbing an instance method on a class

brian ford brixen at gmail.com
Thu Dec 21 00:25:49 EST 2006


Hi all,

I'm not sure if I've missed it, but I couldn't find any docs for
stubbing an instance method on a class. For example:

class Foo; end

Foo.stub!(:my_instance_method).and_return(nil)

The reason (I think) I need this is because a certain class
(Test::Unit::TestCase) expects an argument (name of method) to new and
throws an exception if that instance method doesn't exist.

Thanks,
Brian


More information about the rspec-users mailing list