class Test::Reporters::Summary

Summary Reporter

Constants

SEP

Public Instance Methods

begin_case(tc) click to toggle source
# File lib/rubytest/format/summary.rb, line 18
def begin_case(tc)
  @tc << tc.to_s.split("\n").first
end
begin_suite(suite) click to toggle source
# File lib/rubytest/format/summary.rb, line 12
def begin_suite(suite)
  timer_reset
  @tc = []
end
end_case(test_case) click to toggle source
# File lib/rubytest/format/summary.rb, line 83
def end_case(test_case)
  @tc.pop
end
end_suite(suite) click to toggle source
# File lib/rubytest/format/summary.rb, line 88
def end_suite(suite)
  puts

  unless record[:pending].empty?
    puts "PENDING:\n\n"
    record[:pending].each do |test, exception|
      puts "    #{test}"
      puts "    #{file_and_line(exception)}"
      puts
    end
  end

  unless record[:fail].empty?
    puts "FAILURES:\n\n"
    record[:fail].each do |test, exception|
      puts "    #{test}"
      puts "    #{file_and_line(exception)}"
      puts "    #{exception}"
      puts code(exception).to_s
      #puts "    #{exception.backtrace[0]}"
      puts
    end
  end

  unless record[:error].empty?
    puts "ERRORS:\n\n"
    record[:error].each do |test, exception|
      puts "    #{test}"
      puts "    #{file_and_line(exception)}"
      puts "    #{exception}"
      puts code(exception).to_s
      #puts "    #{exception.backtrace[0]}"
      puts
    end
  end

  puts timestamp
  puts
  puts tally
end
error(test, exception) click to toggle source
# File lib/rubytest/format/summary.rb, line 55
def error(test, exception)
  print "ERROR  ".ansi(:red, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:red)
end
fail(test, exception) click to toggle source
# File lib/rubytest/format/summary.rb, line 48
def fail(test, exception)
  print "FAIL  ".ansi(:red, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:red)
end
omit(test) click to toggle source
# File lib/rubytest/format/summary.rb, line 69
def omit(test)
  print "OMIT  ".ansi(:cyan, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:cyan)
end
pass(test) click to toggle source
# File lib/rubytest/format/summary.rb, line 41
def pass(test)
  print "PASS  ".ansi(:green, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:green)
end
skip_test(test) click to toggle source
# File lib/rubytest/format/summary.rb, line 76
def skip_test(test)
  print "SKIP ".ansi(:blue, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:blue)
end
todo(test, exception) click to toggle source
# File lib/rubytest/format/summary.rb, line 62
def todo(test, exception)
  print "TODO  ".ansi(:yellow, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:yellow)
end

Private Instance Methods

timer() click to toggle source
# File lib/rubytest/format/summary.rb, line 132
def timer
  secs  = Time.now - @time
  @time = Time.now
  return "%0.5fs" % [secs.to_s]
end
timer_reset() click to toggle source
# File lib/rubytest/format/summary.rb, line 139
def timer_reset
  @time = Time.now
end