From: Tom Clarke Date: 2003-01-10T13:06:27+09:00 Subject: Re: Adding hooks to TestUnit On Fri, Jan 10, 2003 at 10:40:16AM +0900, nathaniel@NOSPAMtalbott.ws wrote: > Tom Clarke [mailto:tom@u2i.com] wrote: > > > How about this: > > > > Module Web > > Module Testing > > add_pre_setup_hook { > > # do my initialization > > } > > end > > end > > > > So that add_pre_setup_hook is a method on TestCase, which > > will add one or more hooks (passed as a block) when called - > > in this case when the module is included. > > I've got to mull this over some more, because I'm still not sure it's > the best way to go. For instance, here's an easy way to make sure that > users don't introduce subtle bugs by forgetting to call #super in > #setup: Fair enough, I don't mind using the super method for the time being. Of course I'd rather not have to make anyone call anything if possible. > BTW, thanks for making testing such an important part of Narf. I love > having well-tested and easy-to-test infrastructure on which to base > applications. Thanks! -Tom