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
David Chelimsky
2006-Dec-21 11:48 UTC
[rspec-users] Stubbing an instance method on a class
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: http://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152> > 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 >
David, Thanks for the response. I''ll be sure to check the RFE''s first next time. Forgot to do that. :( Brian On 12/21/06, David Chelimsky <dchelimsky at gmail.com> wrote:> 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: > > http://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152 > > > > > 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 > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2006-Dec-21 23:51 UTC
[rspec-users] Stubbing an instance method on a class
On 12/21/06, brian ford <brixen at gmail.com> wrote:> David, > > Thanks for the response. I''ll be sure to check the RFE''s first next > time. Forgot to do that. :(No worries. Just because there''s an RFE doesn''t mean it''s going to get implemented anyhow. So if you see something on the list that you care about, let us know. I was just letting you know that it''s on the radar. Cheers, David> > Brian > > On 12/21/06, David Chelimsky <dchelimsky at gmail.com> wrote: > > 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: > > > > http://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152 > > > > > > > > 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 > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >