From: Dave Thomas Date: 2001-11-29T14:41:22+09:00 Subject: [ruby-talk:26867] Small RubyUnit extension At the back of my mind, I seem to remember someone doing something similar to this, but I couldn't find it, so... I got sick of typing all the housekeeping when creating a new RubyUnit test class, so I wrote something to make it simpler. Now I just say: require 'rubyunit' class TestSomething < TestCase def test_one assert_equals(1, 2) end end (No more runit/, RUNIT::, and TestRunner.run(...) stuff--that's the whole file). I assume that my tests are in a separate file, and that the file may contain multiple test classes. The file I 'require' contains: require 'runit/testcase' require 'runit/cui/testrunner' module RUNIT TEST_CLASSES = [] def TestCase.inherited(test_class) TEST_CLASSES << test_class end end TestCase = RUNIT::TestCase END { suite = RUNIT::TestSuite.new if ARGV.size == 0 RUNIT::TEST_CLASSES.each {|klass| suite.add(klass.suite)} else if RUNIT::TEST_CLASSES.size > 1 raise "Can't specify individual methods with more that one test class in file" end ARGV.each do |testmethod| suite.add(RUNIT::TEST_CLASSES[0].new(testmethod)) end end RUNIT::CUI::TestRunner.run(suite) } Suketa-san: is there any chance that something like this could be incorporated into the distribution? Regards Dave