From: ara.t.howard@... Date: 2006-06-08T00:31:39+09:00 Subject: Re: properly extending test::unit to add logging On Thu, 8 Jun 2006, Rob Sanheim wrote: > Hi, > > I'd like to open up test::unit to add default logging to setup and > teardown. In java I did this with a base test class that every other > test extended, but that was never very nice as you had to remember to > call super in subclasses. The other option was adding aspects and all > that complexity. So I thought I could do it nicer in ruby with the > following: > > alias_method :old_setup, :setup > def setup > logger.debug "**** Beginning setup for: #{name} ****" > old_setup > end whenever you wrap methods like this __always__, __always__, __always__ do this alias_method "old_method", "method" def method *a, &b # ... old_method *a, &b # ... end you need to collect any args and block and pass them through. regards. -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama