class SpecTimer::Reporter

Public Class Methods

report() click to toggle source
# File lib/spec_timer/reporter.rb, line 2
def self.report
  long_tests = SpecTimer::Timer.long_tests
  puts SpecTimer::Color.text("\n\nUsing SpecTimer", :yellow)

  if long_tests.any?
    puts "Long Tests:"
    long_tests.each_with_index do |test, index|
      puts SpecTimer::Color.text("\n  #{index + 1}) #{test[:name]}", :yellow)
      puts SpecTimer::Color.text("    Took to long: #{test[:time]} seconds!", :red)
      puts SpecTimer::Color.text("    # #{test[:file]}", :cyan)
    end
    puts "\nSlow examples:"
    long_tests.each do |test|
      print SpecTimer::Color.text("rspec #{test[:file]} ", :red)
      puts SpecTimer::Color.text("# #{test[:name]}", :cyan)
    end
  else
    puts SpecTimer::Color.text("All tests are under the maximum allowed time!", :green)
  end
end