Forrest Cao's Library tagged → View Popular
21 croissants' Blog: Set up rspec on Rails
#!/usr/bin/env ruby
module Autotest::GnomeNotify
# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 4
ERROR_STOCK_ICON = "gtk-dialog-error"
SUCCESS_STOCK_ICON = "gtk-dialog-info"
# Convenience method to send an error notification message
#
# [stock_icon] Stock icon name of icon to display
# [title] Notification message title
# [message] Core message for the notification
def self.notify stock_icon, title, message
options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
system "notify-send #{options} '#{title}' '#{message}'"
end
Autotest.add_hook :red do |at|
notify ERROR_STOCK_ICON, "Tests failed", "#{at.files_to_test.size} tests failed"
end
Autotest.add_hook :green do |at|
notify SUCCESS_STOCK_ICON, "All tests passed, good job!", ""
end
end
# a pop up window will appear to display the tests results
# More examples in /usr/lib/ruby/gems/1.8/gems/zentest-3.5.0/example_dot_autotest.rb
# see http://ph7spot.com/articles/getting_started_with_autotest
Selected Tags
Related Tags
Sponsored Links
Top Contributors
Groups interested in test
-
Rspec Intro
RSpec is a Behaviour Driven...
Items: 11 | Visits: 234
Created by: Vincent Tsao
-
Test sites
Sites to be tested on the C...
Items: 99 | Visits: 127
Created by: Jan van Bekkum
-
Mouvement Démocrate FR
un test pour les tags du modem
Items: 7 | Visits: 125
Created by: Ako Z°om
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
