Mocha''s mock/stub framework has the ability to stub all methods on a mock given. Does RSpec''s mocking framework have this ability? And if not, is there some reason it shouldn''t be implemeneted? Regards, Scott
On 8/15/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > Mocha''s mock/stub framework has the ability to stub all methods on a > mock given. Does RSpec''s mocking framework have this ability?No> And > if not, is there some reason it shouldn''t be implemeneted? >Not that I can think of. Aslak> Regards, > > Scott > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 8/15/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On 8/15/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > > Mocha''s mock/stub framework has the ability to stub all methods on a > > mock given. Does RSpec''s mocking framework have this ability? > > NoErr, actually it is possible. (I first thought about "stub methods on all instances of a class" which mocha does, but RSpec doesn''t). mock("person", :null_object => true) Is this what you''re after? See RDoc for details. Aslak> > > And > > if not, is there some reason it shouldn''t be implemeneted? > > > > Not that I can think of. > > Aslak > > > Regards, > > > > Scott > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > >
On 8/14/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On 8/15/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > > Mocha''s mock/stub framework has the ability to stub all methods on a > > mock given. Does RSpec''s mocking framework have this ability? >You mean like :null_object => true ?? =========== http://rspec.rubyforge.org/documentation/mocks/mocks.html "As above, but allows you to specific options to tweak the mock''s behaviour. The options argument is a hash. Currently the only supported option is :null_object. Setting this to true instructs the mock to ignore (quietly consume) any messages it hasn''t been told to expect ? and return itself. i.e. my_mock = mock("blah", :null_object => true)
On Aug 14, 2007, at 7:09 PM, Courtenay wrote:> On 8/14/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: >> On 8/15/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: >>> >>> Mocha''s mock/stub framework has the ability to stub all methods on a >>> mock given. Does RSpec''s mocking framework have this ability? >> > > You mean like :null_object => true ??Yes, actually that works well. Aslak - were you understanding me to ask for Mocha''s any_instance stub ? Thanks, Scott> > ===========> > http://rspec.rubyforge.org/documentation/mocks/mocks.html > > "As above, but allows you to specific options to tweak the mock''s > behaviour. The options argument is a hash. Currently the only > supported option is :null_object. Setting this to true instructs the > mock to ignore (quietly consume) any messages it hasn''t been told to > expect ? and return itself. i.e. > > my_mock = mock("blah", :null_object => true) > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users