Class: RSpec::Core::Formatters::DocumentationFormatter
- Inherits:
-
BaseTextFormatter
show all
- Defined in:
- lib/rspec/core/formatters/documentation_formatter.rb
Constant Summary
Constant Summary
BaseTextFormatter::VT100_COLORS, BaseTextFormatter::VT100_COLOR_CODES
Constants included
from Helpers
Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION
Instance Attribute Summary
#duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples
Instance Method Summary
(collapse)
#close, #color_code_for, #colorise_summary, #colorize, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line
#close, #dump_failures, #dump_pending, #dump_summary, #example_started, #format_backtrace, #message, #start, #start_dump, #stop
Methods included from Helpers
#format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes
#format_backtrace
Constructor Details
A new instance of DocumentationFormatter
7
8
9
10
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 7
def initialize(output)
super(output)
@group_level = 0
end
|
Instance Method Details
- (Object) current_indentation
57
58
59
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 57
def current_indentation
' ' * @group_level
end
|
- (Object) example_failed(example)
35
36
37
38
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 35
def example_failed(example)
super(example)
output.puts failure_output(example, example.execution_result[:exception])
end
|
- (Object) example_group_chain
61
62
63
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 61
def example_group_chain
example_group.parent_groups.reverse
end
|
- (Object) example_group_finished(example_group)
21
22
23
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 21
def example_group_finished(example_group)
@group_level -= 1
end
|
- (Object) example_group_started(example_group)
12
13
14
15
16
17
18
19
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 12
def example_group_started(example_group)
super(example_group)
output.puts if @group_level == 0
output.puts "#{current_indentation}#{example_group.description.strip}"
@group_level += 1
end
|
- (Object) example_passed(example)
25
26
27
28
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 25
def example_passed(example)
super(example)
output.puts passed_output(example)
end
|
- (Object) example_pending(example)
30
31
32
33
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 30
def example_pending(example)
super(example)
output.puts pending_output(example, example.execution_result[:pending_message])
end
|
- (Object) failure_output(example, exception)
40
41
42
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 40
def failure_output(example, exception)
failure_color("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})")
end
|
- (Object) next_failure_index
44
45
46
47
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 44
def next_failure_index
@next_failure_index ||= 0
@next_failure_index += 1
end
|
- (Object) passed_output(example)
49
50
51
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 49
def passed_output(example)
success_color("#{current_indentation}#{example.description.strip}")
end
|
- (Object) pending_output(example, message)
53
54
55
|
# File 'lib/rspec/core/formatters/documentation_formatter.rb', line 53
def pending_output(example, message)
pending_color("#{current_indentation}#{example.description.strip} (PENDING: #{message})")
end
|