@private
# File lib/rspec/core/formatters/documentation_formatter.rb, line 11 def initialize(output) super @group_level = 0 end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 35 def example_failed(failure) output.puts failure_output(failure.example, failure.example.execution_result.exception) end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 23 def example_group_finished(notification) @group_level -= 1 end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 16 def example_group_started(notification) output.puts if @group_level == 0 output.puts "#{current_indentation}#{notification.group.description.strip}" @group_level += 1 end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 27 def example_passed(passed) output.puts passed_output(passed.example) end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 31 def example_pending(pending) output.puts pending_output(pending.example, pending.example.execution_result.pending_message) end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 58 def current_indentation ' ' * @group_level end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 62 def example_group_chain example_group.parent_groups.reverse end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 49 def failure_output(example, exception) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})", :failure) end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 53 def next_failure_index @next_failure_index ||= 0 @next_failure_index += 1 end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 41 def passed_output(example) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success) end
# File lib/rspec/core/formatters/documentation_formatter.rb, line 45 def pending_output(example, message) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} (PENDING: #{message})", :pending) end