Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/formatters/documentation_formatter.rb | 71 | 53 | 77.46%
|
73.58%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 require 'rspec/core/formatters/base_text_formatter' |
2 |
3 module RSpec |
4 module Core |
5 module Formatters |
6 |
7 class DocumentationFormatter < BaseTextFormatter |
8 |
9 def initialize(output) |
10 super(output) |
11 @group_level = 0 |
12 end |
13 |
14 def example_group_started(example_group) |
15 super(example_group) |
16 |
17 output.puts if @group_level == 0 |
18 output.puts "#{current_indentation}#{example_group.description}" |
19 |
20 @group_level += 1 |
21 end |
22 |
23 def example_group_finished(example_group) |
24 @group_level -= 1 |
25 end |
26 |
27 def example_passed(example) |
28 super(example) |
29 output.puts passed_output(example) |
30 end |
31 |
32 def example_pending(example) |
33 super(example) |
34 output.puts pending_output(example, example.execution_result[:pending_message]) |
35 end |
36 |
37 def example_failed(example) |
38 super(example) |
39 output.puts failure_output(example, example.execution_result[:exception]) |
40 end |
41 |
42 def failure_output(example, exception) |
43 red("#{current_indentation}#{example.description} (FAILED - #{next_failure_index})") |
44 end |
45 |
46 def next_failure_index |
47 @next_failure_index ||= 0 |
48 @next_failure_index += 1 |
49 end |
50 |
51 def passed_output(example) |
52 green("#{current_indentation}#{example.description}") |
53 end |
54 |
55 def pending_output(example, message) |
56 yellow("#{current_indentation}#{example.description} (PENDING: #{message})") |
57 end |
58 |
59 def current_indentation |
60 ' ' * @group_level |
61 end |
62 |
63 def example_group_chain |
64 example_group.ancestors.reverse |
65 end |
66 |
67 end |
68 |
69 end |
70 end |
71 end |
Generated on Fri Apr 22 17:22:42 -0700 2011 with rcov 0.9.8