class Tunit::Runnable
Attributes
assertions[RW]
failures[RW]
name[RW]
time[RW]
Public Class Methods
inherited(klass)
click to toggle source
Calls superclass method
# File lib/tunit/runnable.rb, line 15 def self.inherited klass self.runnables << klass super end
new(name)
click to toggle source
# File lib/tunit/runnable.rb, line 33 def initialize name self.name = name self.assertions = 0 self.failures = [] end
run(reporter, options = {})
click to toggle source
# File lib/tunit/runnable.rb, line 20 def self.run reporter, options = {} filter = options.fetch(:filter) { '/./' } filter = Regexp.new $1 if filter =~ /\/(.*)\// filtered_methods = self.runnable_methods.select { |m| filter === m || filter === "#{self}##{m}" } filtered_methods.each { |test| reporter.record self.new(test).run } end
runnable_methods()
click to toggle source
# File lib/tunit/runnable.rb, line 3 def self.runnable_methods raise NotImplementedError, "subclass responsibility" end
runnables()
click to toggle source
# File lib/tunit/runnable.rb, line 7 def self.runnables @@runnables ||= [] end
runnables=(runnable)
click to toggle source
# File lib/tunit/runnable.rb, line 11 def self.runnables= runnable @@runnables = [runnable].flatten end
Private Class Methods
methods_matching(re)
click to toggle source
# File lib/tunit/runnable.rb, line 47 def self.methods_matching re public_instance_methods(true).grep(re).map(&:to_s) end
Public Instance Methods
run()
click to toggle source
# File lib/tunit/runnable.rb, line 41 def run fail NotImplementedError, "subclass responsibility" end