.kick
require 'set'
process do |file, flags|
test_files = Set.new
case file
when %r(^spec/.*_spec.rb$)
test_files << file
when %r(^lib/(.*).rb)
test_files << 'spec/lib/' + $1 + '_spec.rb'
end
test_files = test_files.select { |filename| File.exist?(filename) }
unless test_files.empty?
watcher.execute("rake test TEST=#{test_files.to_a.join(' ')}")
end
end