Sha256: 328c523ef39e5a92f92d3cf113dd7f7689442fd3c6401e537885b2d8684ae570

Contents?: true

Size: 738 Bytes

Versions: 12

Compression:

Stored size: 738 Bytes

Contents

require "test_notifier"
require "test/unit/ui/console/testrunner"

class Test::Unit::UI::Console::TestRunner
  alias finished_original finished

  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
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
test_notifier-2.0.3 lib/test_notifier/runner/test_unit.rb
test_notifier-2.0.2 lib/test_notifier/runner/test_unit.rb
test_notifier-2.0.1 lib/test_notifier/runner/test_unit.rb
test_notifier-2.0.0 lib/test_notifier/runner/test_unit.rb
test_notifier-1.0.1 lib/test_notifier/runner/test_unit.rb
test_notifier-1.0.0 lib/test_notifier/runner/test_unit.rb
test_notifier-0.4.0 lib/test_notifier/runner/test_unit.rb
test_notifier-0.3.6 lib/test_notifier/runner/test_unit.rb
test_notifier-0.3.5 lib/test_notifier/runner/test_unit.rb
test_notifier-0.3.5.rc.4 lib/test_notifier/runner/test_unit.rb
test_notifier-0.3.5.rc.3 lib/test_notifier/runner/test_unit.rb
test_notifier-0.3.5.rc.2 lib/test_notifier/runner/test_unit.rb