Hi all,
I’m trying to setup autotest (gem zentest 3.4.1.) to send notifications
to Growl (see .autotest contents below)
It works fine when all the tests pass, and displays the following
notification :
1 tests, 0 assertions, 0 failures, 0 errors
BUT when a test fails, the notification looks like this:
0x226e0dc @new_record=true,
@errors=#<ActiveRecord::Errors:0x226908c @base=#<User:0x226e0dc …>,
@errors
I tried all the different autotest config code I could find on the web,
but the only one that works is the one below.
Any idea?
TIA
Alain
file <project_root>/.autotest :
require 'autotest/redgreen'
module Autotest::Growl
def self.growl title, msg, pri=0, stick=""
system "growlnotify -n autotest --image
./public/images/rails.png -p #{pri} -m #{msg.inspect} #{title}
#{stick}"
end
Autotest.add_hook :ran_command do |at|
output = at.results.slice(/(\d+).*errors/)
if output =~ /@errors/
# if output =~ /ns.*[1-9]/
growl "Test FAILED - #{at.results.class}", "#{output}", 2,
“-s”
else
growl “All Tests passed”, “#{output}”
end
end
end