Growl, Autotest and RSpec 1.0.8

Clarinex For Sale Coumadin Generic Buy Prozac Online Elimite Without Prescription Aldactone No Prescription Inderal For Sale Nizoral Generic Buy Elavil Online Ultram Without Prescription Nexium No Prescription

So I’ve finally gotten myself a mac. Well, actually my boss got one for me, but you get the point. Anyways, my coworkers and I were having problems with Autotest, RSpec, and Growl before the recent release. However, since 1.0.8 is a new version, we decided to try again. So far it’s worked. So with a big thanks to Daniel Fischer, I’d like to write up how.

How-to

Here’s how. First, get your essentials:

  • Growl
  • growlnotify
  • Zentest
  • Rspec

Second, download the following pictures:
rspec-okay
rspec-fail
rspec-pending

Third, copy the following into your .autotest file:

module Autotest::Growl
  def self.growl title, msg, img, pri=0, stick=""
    system "growlnotify -n autotest --image #{img} -p #{pri} -m #{ msg.inspect} #{title} #{stick}"
  end

  Autotest.add_hook :ran_command do |autotest|
    output = autotest.results.grep(/\d+\s.*examples?/).last.slice(/(\d+)\s.*examples?,\s(\d+)\s.*failures?(?:,\s(\d+)\s.*pending)?/)
    if output =~ /[1-9]\sfailures?/
      growl "Test Results", "#{output}", "~/Library/autotest/rails_fail.png", 2, "-s"
    elsif output =~ /pending/
      growl "Test Results", "#{output}", "~/Library/autotest/rails_pending.png"
    else
      growl "Test Results", "#{output}", "~/Library/autotest/rails_ok.png"
    end
  end
end

If you don’t already have one. Just save it to ~/.autotest. Replace the three image locations with your downloaded ones, and you should be good to go!