Class: SpecdocFormatter

Inherits:
DottedFormatter show all
Defined in:
lib/mspec/runner/formatters/specdoc.rb

Instance Attribute Summary

Attributes inherited from DottedFormatter

#exceptions, #tally, #timer

Instance Method Summary collapse

Methods inherited from DottedFormatter

#exception?, #failure?, #finish, #initialize, #print

Constructor Details

This class inherits a constructor from DottedFormatter

Instance Method Details

#after(state) ⇒ Object

Callback for the MSpec :after event. Prints a newline to finish the description string output.



38
39
40
# File 'lib/mspec/runner/formatters/specdoc.rb', line 38

def after(state)
  print "\n"
end

#before(state) ⇒ Object

Callback for the MSpec :before event. Prints the it block string.



18
19
20
21
# File 'lib/mspec/runner/formatters/specdoc.rb', line 18

def before(state)
  super
  print "- #{state.it}"
end

#enter(describe) ⇒ Object

Callback for the MSpec :enter event. Prints the describe block string.



12
13
14
# File 'lib/mspec/runner/formatters/specdoc.rb', line 12

def enter(describe)
  print "\n#{describe}\n"
end

#exception(exception) ⇒ Object

Callback for the MSpec :exception event. Prints either ‘ERROR - X’ or ‘FAILED - X’ where X is the sequential number of the exception raised. If there has already been an exception raised while evaluating this example, it prints another it block description string so that each discription string has an associated ‘ERROR’ or ‘FAILED’



30
31
32
33
34
# File 'lib/mspec/runner/formatters/specdoc.rb', line 30

def exception(exception)
  print "\n- #{exception.it}" if exception?
  super
  print " (#{exception.failure? ? 'FAILED' : 'ERROR'} - #{@count})"
end

#registerObject



5
6
7
8
# File 'lib/mspec/runner/formatters/specdoc.rb', line 5

def register
  super
  MSpec.register :enter, self
end