Class: StartingBlocks::Extensions::GrowlAlert

Inherits:
Object
  • Object
show all
Defined in:
lib/starting_blocks-growl.rb

Instance Method Summary collapse

Constructor Details

#initializeGrowlAlert

Returns a new instance of GrowlAlert.



8
9
10
11
# File 'lib/starting_blocks-growl.rb', line 8

def initialize
  @g = Growl.new "localhost", "Test Run"
  @g.add_notification "starting_blocks Notification"
end

Instance Method Details

#message(title, message) ⇒ Object



34
35
36
# File 'lib/starting_blocks-growl.rb', line 34

def message title, message
  @g.notify "starting_blocks Notification", title, message
end

#receive_files_to_run(files) ⇒ Object



13
14
15
16
17
# File 'lib/starting_blocks-growl.rb', line 13

def receive_files_to_run files
  @spec_count = files.count
  return if files.count == 0
  message "Starting Test Run", files.join(', ')
end

#receive_results(results) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/starting_blocks-growl.rb', line 19

def receive_results results
  return if @spec_count == 0
  if (results[:tests] || 0) == 0
    message "No Tests To Run", ""
  elsif (results[:errors] || 0) > 0
    message "Fail", "#{results[:errors]} errors"
  elsif (results[:failures] || 0) > 0
    message "Fail", "#{results[:failures]} fails"
  elsif (results[:skips] || 0) > 0
    message "Skipped", "#{results[:skips]} skips"
  else
    message "Success", "#{results[:tests]} passed"
  end
end