blob: d0a82fe6828de94dd42a73a8c7fc9814a85f6b41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
module MultiFormatter
def self.extend_object(obj)
super
obj.multi_initialize
end
def multi_initialize
@counter = @tally = Tally.new
@timer = TimerAction.new
@timer.start
end
def register
super
MSpec.register :start, self
MSpec.register :unload, self
MSpec.unregister :before, self
end
def aggregate_results(files)
require 'yaml'
@timer.finish
@exceptions = []
files.each do |file|
contents = File.read(file)
d = YAML.load(contents)
File.delete file
if d # The file might be empty if the child process died
@exceptions += Array(d['exceptions'])
@tally.files! d['files']
@tally.examples! d['examples']
@tally.expectations! d['expectations']
@tally.errors! d['errors']
@tally.failures! d['failures']
end
end
end
def print_exception(exc, count)
print "\n#{count})\n#{exc}\n"
end
end
|