Class: RSpecGrowler

Inherits:
Spec::Runner::Formatter::BaseFormatter
  • Object
show all
Includes:
RSpactor::Growl
Defined in:
lib/rspec_growler.rb

Constant Summary

Constants included from RSpactor::Growl

RSpactor::Growl::IMAGE_PATH

Instance Method Summary collapse

Methods included from RSpactor::Growl

#image_path, #notify

Instance Method Details

#dump_summary(duration, total, failures, pending) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rspec_growler.rb', line 7

def dump_summary(duration, total, failures, pending)
  icon = if failures > 0
    'failed'
  elsif pending > 0
    'pending'
  else
    'success'
  end
  
  image_path = File.dirname(__FILE__) + "/../images/#{icon}.png"
  message = "#{total} examples, #{failures} failures"
  
  if pending > 0
    message << " (#{pending} pending)"
  end
  
  notify "Test Results", message, image_path(icon)
end