Skip to content

Commit

Permalink
Now with more growl.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Strelau committed Mar 23, 2011
1 parent 9f4114d commit 494dcef
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/guard/forku.rb
Expand Up @@ -5,10 +5,9 @@ module Guard
class Forku < Guard class Forku < Guard


def start def start
UI.info "Loading test_helper"
require 'test_helper' require 'test_helper'
ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord::Base) ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord::Base)
UI.info "Ready" notify 'Ready to test. Code away.'
end end


# Called on Ctrl-/ signal # Called on Ctrl-/ signal
Expand All @@ -18,7 +17,6 @@ def start
def run_all def run_all
%w[unit functional integration performance].each do |test| %w[unit functional integration performance].each do |test|
load_in_fork("test/#{test}/**/*_test.rb") load_in_fork("test/#{test}/**/*_test.rb")
Process.wait
end end
end end


Expand All @@ -37,14 +35,27 @@ def load_in_fork(*paths)
ActiveRecord::Base.establish_connection if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection if defined?(ActiveRecord::Base)
$0 = paths.join(' ') # test/unit uses this $0 = paths.join(' ') # test/unit uses this
if paths.empty? if paths.empty?
UI.info "No tests found. Skipping." notify "No tests found", image: :pending
exit! # skip test/unit autorun exit! # skip test/unit autorun
else else
paths.each {|p| load p } paths.each {|p| load p }
end end
end end
if Process.wait > 0
notify "PASS"
else
notify "FAIL", image: :failed
end
end end
private :load_in_fork private :load_in_fork



def notify(message, opts={})
if options[:notify]
Notifier.notify(message, opts)
else
UI.info("*** " << message)
end
end
end end
end end

0 comments on commit 494dcef

Please sign in to comment.