class RSpec::Core::Formatters::DocumentationFormatter
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 7 def initialize(output) super(output) @group_level = 0 end
Public Instance Methods
current_indentation()
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 57 def current_indentation ' ' * @group_level end
example_failed(example)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::BaseFormatter#example_failed
# 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
example_group_chain()
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 61 def example_group_chain example_group.parent_groups.reverse end
example_group_finished(example_group)
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 21 def example_group_finished(example_group) @group_level -= 1 end
example_group_started(example_group)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::BaseFormatter#example_group_started
# 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
example_passed(example)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::BaseFormatter#example_passed
# File lib/rspec/core/formatters/documentation_formatter.rb, line 25 def example_passed(example) super(example) output.puts passed_output(example) end
example_pending(example)
click to toggle source
Calls superclass method
RSpec::Core::Formatters::BaseFormatter#example_pending
# 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
failure_output(example, exception)
click to toggle source
# 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
next_failure_index()
click to toggle source
# File lib/rspec/core/formatters/documentation_formatter.rb, line 44 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 49 def passed_output(example) success_color("#{current_indentation}#{example.description.strip}") end
pending_output(example, message)
click to toggle source
# 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