Class: DescribeFormatter

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

Instance Attribute Summary

Attributes inherited from DottedFormatter

#exceptions, #tally, #timer

Instance Method Summary collapse

Methods inherited from DottedFormatter

#after, #before, #exception, #exception?, #failure?, #initialize, #print, #register

Constructor Details

This class inherits a constructor from DottedFormatter

Instance Method Details

#finishObject

Callback for the MSpec :finish event. Prints a summary of the number of errors and failures for each describe block.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mspec/runner/formatters/describe.rb', line 7

def finish
  describes = Hash.new { |h,k| h[k] = Tally.new }

  @exceptions.each do |exc|
    desc = describes[exc.describe]
    exc.failure? ? desc.failures! : desc.errors!
  end

  print "\n"
  describes.each do |d, t|
    text = d.size > 40 ? "#{d[0,37]}..." : d.ljust(40)
    print "\n#{text} #{t.failure}, #{t.error}"
  end
  print "\n" unless describes.empty?

  print "\n#{@timer.format}\n\n#{@tally.format}\n"
end