class MiniTest::Unit::TestCase
def self.inherited klass
def self.inherited klass @@test_suites[klass] = true end
def self.reset
def self.reset @@test_suites = {} end
def self.test_methods
def self.test_methods methods = public_instance_methods(true).grep(/^test/).map { |m| m.to_s }.sort if self.test_order == :random then max = methods.size methods = methods.sort_by { rand(max) } end methods end
def self.test_order
def self.test_order :random end
def self.test_suites
def self.test_suites @@test_suites.keys.sort_by { |ts| ts.name } end
def initialize name
def initialize name @__name__ = name @passed = nil end
def passed?
def passed? @passed end
def run runner
def run runner result = '.' begin @passed = nil self.setup self.__send__ self.__name__ @passed = true rescue Exception => e @passed = false result = runner.puke(self.class, self.__name__, e) ensure begin self.teardown rescue Exception => e result = runner.puke(self.class, self.__name__, e) end end result end
def setup; end
def setup; end
def teardown; end
def teardown; end