Class: Minitest::Growler

Inherits:
StatisticsReporter
  • Object
show all
Defined in:
lib/minitest/growler_plugin.rb

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Growler

Returns a new instance of Growler.



26
27
28
# File 'lib/minitest/growler_plugin.rb', line 26

def initialize(options)
  super
end

Class Method Details

.growler!Object



18
19
20
# File 'lib/minitest/growler_plugin.rb', line 18

def self.growler!
  @growler = true
end

.growler?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/minitest/growler_plugin.rb', line 22

def self.growler?
  @growler ||= false
end

Instance Method Details

#image_path(type) ⇒ Object



44
45
46
# File 'lib/minitest/growler_plugin.rb', line 44

def image_path(type)
  File.join(File.expand_path(File.dirname(__FILE__)), 'images', "#{type}.png")
end

#notify(message, image_type) ⇒ Object



40
41
42
# File 'lib/minitest/growler_plugin.rb', line 40

def notify(message, image_type)
  Growl.notify(message, :image => image_path(image_type))
end

#reportObject



30
31
32
33
34
35
36
37
38
# File 'lib/minitest/growler_plugin.rb', line 30

def report
  super

  if failures.to_i > 0 || errors.to_i > 0
    notify("Tests Failed! (#{failures.to_i} failures, #{errors.to_i} errors)", :failure)
  else
    notify("Tests Passed! (#{assertions.to_i} assertions)", :success)
  end
end