Sha256: 9b2c1fb9db8024e9681d47eeed1aca25149660235177fd4e085b17ca4eb815ba

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require "minitest/reporters"

module Aviator
class Test

  class SpecReporter < MiniTest::Reporters::SpecReporter

    private

    def pad_test(test)
      str = test.to_s.gsub(/(test_)/, '').gsub(/_/, ' ')
      pad("%-#{TEST_SIZE}s" % str, TEST_PADDING)[0..TEST_SIZE]
    end

    def print_info(e)
      print "       #{e.exception.class.to_s}:\n"
      e.message.each_line { |line| print_with_info_padding(line) }

      trace = filter_backtrace(e.backtrace)

      # TODO: Use the proper MiniTest way of customizing the filter
      trace.each { |line| print_with_info_padding(line) unless line =~ /\.rvm|gems|_run_anything/ }
    end

    def print_suite(suite)
      puts suite.name.gsub('::#', '#')
      @suites << suite
    end
  end


  class ProgressReporter < MiniTest::Reporters::ProgressReporter

    private

    def print_test_with_time(suite, test)
      total_time = Time.now - (runner.test_start_time || Time.now)
      suite_name = suite.name.gsub('::#', '#').gsub('::::', '::')
      test_name  = test.to_s.gsub(/test_\d+|_/, ' ').strip
      print(" %s %s (%.2fs)%s" % [suite_name, test_name, total_time, clr])
    end
  end

end
end

MiniTest::Reporters.use! Aviator::Test::ProgressReporter.new

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aviator-0.0.6 test/support/test_reporter.rb
aviator-0.0.5 test/support/test_reporter.rb
aviator-0.0.4 test/support/test_reporter.rb
aviator-0.0.3 test/support/test_reporter.rb