Class: Spec::Runner::Formatter::NestedTextFormatter
Constant Summary
collapse
- INDENT =
' '
Instance Attribute Summary
#example_group, #output
Instance Method Summary
collapse
#close, #colorize_failure, #colourise, #dump_failure, #dump_pending, #dump_summary, #format_backtrace
#add_example_group, #close, #dump_failure, #dump_pending, #dump_summary, #example_started, #start, #start_dump
Constructor Details
Returns a new instance of NestedTextFormatter.
10
11
12
13
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 10
def initialize(options, where)
super
@last_nested_descriptions = []
end
|
Instance Method Details
#current_indentation ⇒ Object
44
45
46
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 44
def current_indentation
INDENT*@last_nested_descriptions.length
end
|
#example_failed(example, counter, failure) ⇒ Object
27
28
29
30
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 27
def example_failed(example, counter, failure)
output.puts(red("#{current_indentation}#{example.description} (FAILED - #{counter})"))
output.flush
end
|
#example_group_started(example_group) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 15
def example_group_started(example_group)
super
example_group.nested_descriptions.each_with_index do |nested_description, i|
unless example_group.nested_descriptions[0..i] == @last_nested_descriptions[0..i]
output.puts "#{INDENT*i}#{nested_description}"
end
end
@last_nested_descriptions = example_group.nested_descriptions
end
|
#example_passed(example) ⇒ Object
32
33
34
35
36
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 32
def example_passed(example)
message = "#{current_indentation}#{example.description}"
output.puts green(message)
output.flush
end
|
#example_pending(example, message, deprecated_pending_location = nil) ⇒ Object
38
39
40
41
42
|
# File 'lib/spec/runner/formatter/nested_text_formatter.rb', line 38
def example_pending(example, message, deprecated_pending_location=nil)
super
output.puts yellow("#{current_indentation}#{example.description} (PENDING: #{message})")
output.flush
end
|