Class: MiniTest::Unit

Inherits:
Object show all
Defined in:
lib/ae/adapters/minitest.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#assertion_countObject

MiniTest tracks assertion counts internally in it’s Unit class via the assertion_count attribute. To work with AE we need add in AE’s assertion total by overriding the assertion_count method.



10
11
12
# File 'lib/ae/adapters/minitest.rb', line 10

def assertion_count
  @assertion_count + AE::Assertor.counts[:total]
end

#puke(c, m, x) ⇒ Object

To teach MiniTest to recognize AE’s expanded concept of assertions we add in an extra capture clause to the it’s #puke method.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ae/adapters/minitest.rb', line 15

def puke c, m, x
  case x
  when MiniTest::Skip
    @skips = @skips + 1
    x = "Skipped:\n#{m}(#{c}) [#{location x}]:\n#{x.message}\n"
  when MiniTest::Assertion
    @failures = @failures + 1
    x = "Failure:\n#{m}(#{c}) [#{location x}]:\n#{x.message}\n"
  when x.respond_to?(:assertion?) && x.assertion?
    @failures = @failures + 1
    x = "Failure:\n#{m}(#{c}) [#{location x}]:\n#{x.message}\n"
  else
    @errors = @errors + 1
    b = MiniTest::filter_backtrace(x.backtrace).join("\n ")
    x = "Error:\n#{m}(#{c}):\n#{x.class}: #{x.message}\n #{b}\n"
  end
  @report << x
  x[0, 1]
end