From: Rob Sanheim Date: 2006-06-08T00:27:13+09:00 Subject: properly extending test::unit to add logging 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 Is this the proper way to extend builtin methods, and still preserve the old behavior? I'm thinking the timing that the above code gets called is important. Right now I'm getting one test error when I extend setup as above, as opposed to leaving it out, so I must be dong something wrong. Btw - this w/i a Rails app (the above code is w/i test_helper), but I figured this is more ruby then rails specific. thanks, Rob -- http://www.robsanheim.com http://www.seekingalpha.com http://www.ajaxian.com