Module: Tunit

Defined in:
lib/tunit.rb,
lib/tunit/spec.rb,
lib/tunit/test.rb,
lib/tunit/hooks.rb,
lib/tunit/version.rb,
lib/tunit/reporter.rb,
lib/tunit/runnable.rb,
lib/tunit/assertions.rb,
lib/tunit/assertion_errors.rb,
lib/tunit/summary_reporter.rb,
lib/tunit/compound_reporter.rb,
lib/tunit/progress_reporter.rb

Defined Under Namespace

Modules: Assertions, Hooks Classes: Assertion, CompoundReporter, Empty, ProgressReporter, Reporter, Runnable, Skip, Spec, SummaryReporter, Test

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.autorunObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/tunit.rb', line 21

def self.autorun
  at_exit {
    next if $! and not ($!.kind_of? SystemExit and $!.success?)

    exit_code = nil

    at_exit {
      exit exit_code || false
    }

    exit_code = Tunit.run ARGV
  } unless self.installed_at_exit
  self.installed_at_exit = true
end

.run(args = []) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tunit.rb', line 36

def self.run args = []
  options = process_args! args

  self.reporter = CompoundReporter.new
  reporter << SummaryReporter.new(options[:io], options)
  reporter << ProgressReporter.new(options[:io], options)

  reporter.start
  dispatch! reporter, options
  reporter.report

  reporter.passed?
end