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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/matest/spec_printer.rb', line 11
def print_messages(runner)
puts ("\n\n### Messages ###")
statuses = []
runner.info[:success] = true
runner.info[:num_specs] = { total: 0 }
runner.example_groups.each do |current_group|
current_group.statuses.each do |status|
runner.info[:num_specs][:total] += 1
runner.info[:num_specs][status.class] ||= 0
runner.info[:num_specs][status.class] += 1
if !status.is_a?(Matest::SpecPassed)
puts send(colors[status.class], "\n[#{status.name}] #{status.description}")
puts ("Location")
puts " #{status.location}:"
if status.is_a?(Matest::SpecFailed)
runner.info[:success] = false
puts ("Assertion")
puts expression(" #{status.example.example_block.assertion}")
if status.example.track_variables.any?
puts ("Variables")
status.example.track_variables.each do |var, val|
puts key_value(var, val)
end
end
if status.example.track_lets.any?
puts ("Lets")
status.example.track_lets.each do |var, val|
puts key_value(var, val)
end
end
print_explanation_for(status)
end
if status.is_a?(Matest::NotANaturalAssertion)
runner.info[:success] = false
puts " # => #{status.result.inspect}", reset("")
print_explanation_for(status)
end
if status.is_a?(Matest::ExceptionRaised)
runner.info[:success] = false
puts error("EXCEPTION >> #{status.result}")
status.result.backtrace.each do |l|
puts error(" #{l}")
end
end
end
end
end
puts nil, "-"*50, nil
puts "Specs:"
runner.info[:num_specs].each { |klass, num|
puts send(colors[klass], " #{num} #{klass.to_s.downcase}.")
}
end
|