class RSpec::Core::Formatters::DocumentationFormatter
@private
Public Class Methods
new(output)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::BaseFormatter.new
# File lib/rspec/core/formatters/documentation_formatter.rb, line 11 def initialize(output) super @group_level = 0 end
Public Instance Methods
example_failed(failure)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 36 def example_failed(failure) output.puts failure_output(failure.example, failure.example.execution_result.exception) end
example_group_finished(_notification)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 23 def example_group_finished(_notification) @group_level -= 1 end
example_group_started(notification)
click to toggle source
# 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
example_passed(passed)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 27 def example_passed(passed) output.puts passed_output(passed.example) end
example_pending(pending)
click to toggle source
# 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
Private Instance Methods
current_indentation()
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 64 def current_indentation ' ' * @group_level end
failure_output(example, _exception)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 53 def failure_output(example, _exception) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " "(FAILED - #{next_failure_index})", :failure) end
next_failure_index()
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 59 def next_failure_index @next_failure_index ||= 0 @next_failure_index += 1 end
passed_output(example)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 43 def passed_output(example) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success) end
pending_output(example, message)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 47 def pending_output(example, message) ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " "(PENDING: #{message})", :pending) end