Module: TestBelt::TestCase::ClassMethods

Defined in:
lib/test_belt/testcase.rb

Instance Method Summary collapse

Instance Method Details

#suiteObject

based on Ruby 1.8.7 suite method



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/test_belt/testcase.rb', line 22

def suite
  # this is the only thing I'm changing
  method_names = ::TestBelt::Utils.local_public_instance_methods(self)
  # the rest is all the same
  tests = method_names.delete_if {|method_name| method_name !~ /^test./}
  suite = ::Test::Unit::TestSuite.new(name)
  tests.sort.each do |test|
    catch(:invalid_test) do
      suite << new(test)
    end
  end
  if (suite.empty?)
    catch(:invalid_test) do
      suite << new("default_test")
    end
  end
  return suite
end