Created
September 21, 2009 12:14
-
-
Save elia/190209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this works only on macs... | |
Autotest.add_hook :ran_command do |autotest| | |
results = [autotest.results].flatten.join("\n") | |
examples = results.scan(/(\d+) examples?/).flatten.first.to_i || 0 | |
failures = results.scan(/(\d+) failures?/).flatten.first.to_i || 0 | |
pending = results.scan(/(\d+) pending/).flatten.first.to_i || 0 | |
errors = results.scan(/(\d+) errors?/).flatten.first.to_i || 0 | |
if [examples, failures, pending, errors].any?{|v| v > 0} | |
passed = examples - failures - pending - errors | |
if errors > 0 or failures > 0 | |
`say failed #{failures} of #{examples}` | |
elsif pending > 0 | |
`say pending #{pending} of #{examples}` | |
else | |
`say passed #{passed} of #{examples}` | |
end | |
puts Time.now.strftime("\e[1m%H:%M:%S\e[0m") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment