Class: Test::Unit::UI::Console::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/test_notifier/runner/test_unit.rb

Instance Method Summary collapse

Instance Method Details

#finished(elapsed_time) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/test_notifier/runner/test_unit.rb', line 7

def finished(elapsed_time)
  finished_original(elapsed_time)

  begin
    re = /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/
    _, tests, assertions, failures, errors = *@result.to_s.match(re)
    return if tests.to_i.zero?


    stats = TestNotifier::Stats.new(:test_unit, {
      :count      => tests,
      :assertions => assertions,
      :failures   => failures,
      :errors     => errors
    })

    TestNotifier.notify(:status => stats.status, :message => stats.message)
  rescue => e
    puts e
    puts e.backtrace
  end
end

#finished_originalObject


5
# File 'lib/test_notifier/runner/test_unit.rb', line 5

alias finished_original finished