[rspec-users] Playing Sounds with Autotest/RSpec on Cygwin

Andy Leak andy at r210.com
Tue Feb 19 12:22:45 EST 2008


I've read about integrating Growl with Autotest/RSpec to display test results.
For cygwin users - here is a snippet that will play a sound after autotest runs.
Add the code below to your ~/.autotest file.
Modify the path of the .wav file to the sounds you want to play on your system.

Cheers, Andy

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Module AddSoundtoAutoTestforCygwin

  Autotest.add_hook :ran_command do |at|
    results = [at.results].flatten.join("\n")
    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+not implemented)?/)
    if output
      if $~[2].to_i > 0
        `cat /cygdrive/c/i386/ringout.wav > /dev/dsp`     # failure
      else
        `cat /cygdrive/c/i386/chimes.wav > /dev/dsp`    # success
      end
    end
  end

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080219/d05d06f2/attachment.html 


More information about the rspec-users mailing list