Class: StartingBlocks::Extensions::GrowlAlert
- Inherits:
-
Object
- Object
- StartingBlocks::Extensions::GrowlAlert
- Defined in:
- lib/starting_blocks-growl.rb
Instance Method Summary collapse
-
#initialize ⇒ GrowlAlert
constructor
A new instance of GrowlAlert.
- #message(title, message) ⇒ Object
- #receive_files_to_run(files) ⇒ Object
- #receive_results(results) ⇒ Object
Constructor Details
#initialize ⇒ GrowlAlert
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 title, @g.notify "starting_blocks Notification", title, 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 "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 "No Tests To Run", "" elsif (results[:errors] || 0) > 0 "Fail", "#{results[:errors]} errors" elsif (results[:failures] || 0) > 0 "Fail", "#{results[:failures]} fails" elsif (results[:skips] || 0) > 0 "Skipped", "#{results[:skips]} skips" else "Success", "#{results[:tests]} passed" end end |