class Minitest::Runnable
def self.inherited klass # :nodoc:
re-open
def self.inherited klass # :nodoc: self.runnables << klass super end
def self.methods_matching re
def self.methods_matching re public_instance_methods(true).grep(re).map(&:to_s) end
def self.on_signal name, action # :nodoc:
def self.on_signal name, action # :nodoc: supported = SIGNALS[name] old_trap = trap name do old_trap.call if old_trap.respond_to? :call action.call end if supported yield ensure trap name, old_trap if supported end
def self.reset # :nodoc:
def self.reset # :nodoc: @@runnables = [] end
def self.run reporter, options = {}
def self.run reporter, options = {} filter = options[:filter] || "/./" filter = Regexp.new $1 if filter =~ %r%/(.*)/% filtered_methods = self.runnable_methods.find_all { |m| filter === m || filter === "#{self}##{m}" } exclude = options[:exclude] exclude = Regexp.new $1 if exclude =~ %r%/(.*)/% filtered_methods.delete_if { |m| exclude === m || exclude === "#{self}##{m}" } return if filtered_methods.empty? with_info_handler reporter do filtered_methods.each do |method_name| run_one_method self, method_name, reporter end end end
def self.run_one_method klass, method_name, reporter
def self.run_one_method klass, method_name, reporter reporter.prerecord klass, method_name reporter.record Minitest.run_one_method(klass, method_name) end
def self.runnable_methods
def self.runnable_methods raise NotImplementedError, "subclass responsibility" end
def self.runnables
def self.runnables @@runnables end
def self.with_info_handler reporter, &block # :nodoc:
def self.with_info_handler reporter, &block # :nodoc: handler = lambda do unless reporter.passed? then warn "Current results:" warn "" warn reporter.reporters.first warn "" end end on_signal ::Minitest.info_signal, handler, &block end
def failure # :nodoc:
def failure # :nodoc: self.failures.first end
def initialize name # :nodoc:
def initialize name # :nodoc: self.name = name self.failures = [] self.assertions = 0 end
def name
def name @NAME end
def name= o
def name= o @NAME = o end
def passed?
def passed? raise NotImplementedError, "subclass responsibility" end
def result_code
def result_code raise NotImplementedError, "subclass responsibility" end
def run
def run raise NotImplementedError, "subclass responsibility" end
def skipped?
def skipped? raise NotImplementedError, "subclass responsibility" end
def time_it # :nodoc:
def time_it # :nodoc: t0 = Minitest.clock_time yield ensure self.time = Minitest.clock_time - t0 end