Sha256: 2e2c061e6c8291d6f15e42a5c2a028770d9259ca1d61fb3d15eeb0e5d43a9dd7

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 Bytes

Contents

require 'spec/runner/formatter/base_formatter'

class RSpecGrowler < Spec::Runner::Formatter::BaseFormatter
  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
    
    growl "Test Results", message, image_path, 0
  end
  
  def growl(title, msg, img, pri = 0)
    system("growlnotify -w -n rspactor --image #{img} -p #{pri} -m #{msg.inspect} #{title} &") 
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mislav-rspactor-0.3.2 lib/rspec_growler.rb
mislav-rspactor-0.3.3 lib/rspec_growler.rb