Class: Attest::Output::BasicOutputWriter

Inherits:
OutputWriter show all
Defined in:
lib/attest/output/basic_output_writer.rb

Instance Method Summary collapse

Methods inherited from OutputWriter

#after_all_tests, #an_error, #before_all_tests, #ignore_container, #initialize, #summary

Methods included from OutputWriterInterface

#after_all_tests, #an_error, #before_all_tests, #ignore_container, #summary

Constructor Details

This class inherits a constructor from Attest::Output::OutputWriter

Instance Method Details

#after_container(container) ⇒ Object



14
15
16
# File 'lib/attest/output/basic_output_writer.rb', line 14

def after_container(container)
  puts 
end

#after_test(test_object) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/attest/output/basic_output_writer.rb', line 22

def after_test(test_object)
  relevant_result = determine_relevant_result test_object
  print " [#{relevant_result.status.upcase}]" if relevant_result
  if relevant_result && relevant_result.failure?
    2.times { puts } 
    puts "     #{relevant_result.source_location}"
  elsif relevant_result && relevant_result.error?
    e = relevant_result.attributes[:unexpected_error]
    2.times { puts } 
    puts "     #{e.class}: #{e.message}"
    e.backtrace.each do |line|
      break if line =~ /lib\/attest/
        puts "     #{line} "
    end
  end
  puts
end

#before_container(container) ⇒ Object



7
8
9
10
11
12
# File 'lib/attest/output/basic_output_writer.rb', line 7

def before_container(container)
  previous_container = @containers.last
  @containers << container
  puts "#{container.file}:" unless previous_container && previous_container.file == container.file
  puts " #{ container.description }"
end

#before_test(test_object) ⇒ Object



18
19
20
# File 'lib/attest/output/basic_output_writer.rb', line 18

def before_test(test_object)
  print "  - #{test_object.description}"
end