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

David Chelimsky dchelimsky at gmail.com
Thu Dec 21 06:48:21 EST 2006

On 12/20/06, brian ford <brixen at gmail.com> wrote:
> 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)

Hasn't been implemented yet, but there is an RFE:


> 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
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list