aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mspec/lib/mspec/runner/formatters/dotted.rb
blob: 672cdf81dc66f69eb987c6a8f7db883429696c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'mspec/runner/formatters/base'

class DottedFormatter < BaseFormatter
  def register
    super
    MSpec.register :after, self
  end

  # Callback for the MSpec :after event. Prints an indicator
  # for the result of evaluating this example as follows:
  #   . = No failure or error
  #   F = An SpecExpectationNotMetError was raised
  #   E = Any exception other than SpecExpectationNotMetError
  def after(state = nil)
    super(state)

    if exception?
      print failure? ? "F" : "E"
    else
      print "."
    end
  end
end