Class: MicroTest::BaseFormatter

Inherits:
Object
  • Object
show all
Includes:
Color
Defined in:
lib/micro_test/formatters/base_formatter.rb

Overview

The base class for formatters. Defines the API that formatters can/should implement to control test run output.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseFormatter

Returns a new instance of BaseFormatter.



32
33
34
35
36
# File 'lib/micro_test/formatters/base_formatter.rb', line 32

def initialize
  @duration = 0
  @passed = 0
  @failed = 0
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



16
17
18
# File 'lib/micro_test/formatters/base_formatter.rb', line 16

def duration
  @duration
end

#failedObject

Returns the value of attribute failed.



16
17
18
# File 'lib/micro_test/formatters/base_formatter.rb', line 16

def failed
  @failed
end

#passedObject

Returns the value of attribute passed.



16
17
18
# File 'lib/micro_test/formatters/base_formatter.rb', line 16

def passed
  @passed
end

Class Method Details

.inherited(subclass) ⇒ Object



19
20
21
# File 'lib/micro_test/formatters/base_formatter.rb', line 19

def inherited(subclass)
  MicroTest.formatters << subclass
end

.set_short_name(value) ⇒ Object



27
28
29
# File 'lib/micro_test/formatters/base_formatter.rb', line 27

def set_short_name(value)
  @short_name = value
end

.short_nameObject



23
24
25
# File 'lib/micro_test/formatters/base_formatter.rb', line 23

def short_name
  @short_name || name
end

Instance Method Details

#after_class(test_class) ⇒ Object



50
51
# File 'lib/micro_test/formatters/base_formatter.rb', line 50

def after_class(test_class)
end

#after_results(runner) ⇒ Object



53
54
55
56
57
# File 'lib/micro_test/formatters/base_formatter.rb', line 53

def after_results(runner)
  @duration = runner.duration
  @passed = runner.passed
  @failed = runner.failed
end

#after_suite(test_classes) ⇒ Object



59
60
# File 'lib/micro_test/formatters/base_formatter.rb', line 59

def after_suite(test_classes)
end

#after_test(test) ⇒ Object



47
48
# File 'lib/micro_test/formatters/base_formatter.rb', line 47

def after_test(test)
end

#before_class(test_class) ⇒ Object



41
42
# File 'lib/micro_test/formatters/base_formatter.rb', line 41

def before_class(test_class)
end

#before_suite(test_classes) ⇒ Object



38
39
# File 'lib/micro_test/formatters/base_formatter.rb', line 38

def before_suite(test_classes)
end

#before_test(test) ⇒ Object



44
45
# File 'lib/micro_test/formatters/base_formatter.rb', line 44

def before_test(test)
end