Class: RSpec::Core::Formatters::BaseTextFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/serverspec.rb

Direct Known Subclasses

ProgressFormatter

Instance Method Summary collapse

Instance Method Details

#dump_failure_info(example) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/serverspec.rb', line 66

def dump_failure_info(example)
  exception = example.execution_result[:exception]
  exception_class_name = exception_class_name_for(exception)
  output.puts "#{long_padding}#{failure_color("Failure/Error:")} #{failure_color(read_failed_line(exception, example).strip)}"
  output.puts "#{long_padding}#{failure_color(exception_class_name)}: #{failure_color(exception.message)}" unless exception_class_name =~ /RSpec/
  output.puts "#{long_padding}  #{failure_color(example.[:command])}" if example.[:command]
  output.puts "#{long_padding}  #{failure_color(example.[:stdout])}" if example.[:stdout] != ''
  exception.message.to_s.split("\n").each { |line| output.puts "#{long_padding}  #{failure_color(line)}" } if exception.message

  if shared_group = find_shared_group(example)
    dump_shared_failure_info(shared_group)
  end
end