Module: TopTests

Defined in:
lib/top_tests.rb,
lib/top_tests/version.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VERSION =
"0.0.5".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Class methods ###



9
10
11
12
# File 'lib/top_tests.rb', line 9

def self.included(klass)
  klass.extend(ClassMethods)
  MiniTest::Unit.after_tests { klass.after_all_tests }
end

Instance Method Details

#after_teardownObject



23
24
25
26
27
28
29
30
# File 'lib/top_tests.rb', line 23

def after_teardown
  super
  if @timer_started_at # Unset when a setup hook fails before top test.
    # Instance variable @__name__ is used prior to minitest 5.
    test_name = "#{self.class}##{@__name__ || name}"
    self.class.tests_durations << [test_name, Time.now - @timer_started_at]
  end
end

#before_setupObject

Instance methods ###



18
19
20
21
# File 'lib/top_tests.rb', line 18

def before_setup
  super
  @timer_started_at = Time.now
end