Class: Test::Unit::Collector::ObjectSpace
- Inherits:
-
Object
- Object
- Test::Unit::Collector::ObjectSpace
- Includes:
- Test::Unit::Collector
- Defined in:
- lib/test/unit/collector/objectspace.rb,
lib/test/unit/collector/objectspace.rb
Constant Summary collapse
- NAME =
'collected from the ObjectSpace'
Instance Method Summary collapse
-
#collect(name = NAME) ⇒ Object
-
#initialize(source = ::ObjectSpace) ⇒ ObjectSpace
constructor
A new instance of ObjectSpace.
Methods included from Test::Unit::Collector
#add_suite, #add_test_cases, #filter=, #include?, #sort
Constructor Details
#initialize(source = ::ObjectSpace) ⇒ ObjectSpace
Returns a new instance of ObjectSpace.
11 12 13 14 |
# File 'lib/test/unit/collector/objectspace.rb', line 11 def initialize(source=::ObjectSpace) super() @source = source end |
Instance Method Details
#collect(name = NAME) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/test/unit/collector/objectspace.rb', line 16 def collect(name=NAME) suite = TestSuite.new(name) sub_suites = [] @source.each_object(Class) do |klass| if(Test::Unit::TestCase > klass) add_suite(sub_suites, klass.suite) end end sort(sub_suites).each{|s| suite << s} suite end |