class Guard::Minitest::Notifier

Public Class Methods

guard_image(failure_count, skip_count) click to toggle source

failed | pending (skip) | success

# File lib/guard/minitest/notifier.rb, line 17
def self.guard_image(failure_count, skip_count)
  if failure_count > 0
    :failed
  elsif skip_count > 0
    :pending
  else
    :success
  end
end
guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration) click to toggle source
# File lib/guard/minitest/notifier.rb, line 6
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
  message = "#{test_count} tests"
  message << " (#{skip_count} skipped)" if skip_count > 0
  message << "\n#{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
  if test_count && assertion_count
    message << "\n\n%.2f tests/s, %.2f assertions/s\n\nFinished in %.4f seconds" % [test_count / duration, assertion_count / duration, duration]
  end
  message
end
notify(test_count, assertion_count, failure_count, error_count, skip_count, duration) click to toggle source
# File lib/guard/minitest/notifier.rb, line 27
def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
  message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
  image   = guard_image(failure_count + error_count, skip_count)

  Compat::UI.notify(message, title: 'Minitest results', image: image)
end