On Jan 24, 6:06 pm, Phrogz <phr... / mac.com> wrote:
> On Jan 24, 4:24 pm, brab... / gmail.com wrote:
>
>
>
> > On Jan 24, 2008 6:06 PM,  <brab... / gmail.com> wrote:
>
> > > But, sorry that this doesn't yet work around not knowing the class
> > > names just the file names.
>
> > Maybe:
>
> > require 'test/unit/ui/console/testrunner'
>
> > # global array to hold the test classes as they are loaded
> > $tests = []
>
> > # monkey patch to record the new subclasses as they are loaded
> > class Test::Unit::TestCase
> >   def self.inherited(subclass)
> >     $tests << subclass
> >   end
> > end
>
> Or, avoid the global with:
>
>   class Test::Unit::TestCase
>     class << self
>       attr_reader :subclasses
>       def inherited( subclass )
>         (@subclasses||=[]) << subclass
>       end
>     end
>   end
>
> and then
>
>   Test::Unit::TestCase.subclasses.each do |klass|
>     ...
>   end

Sweet! (or perhaps I should say: suite!)