Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 68bd34acf5
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (31 sloc) 0.777 kB
def run(cmd)
puts(cmd)
output = ""
IO.popen(cmd) do |com|
com.each_char do |c|
print c
output << c
$stdout.flush
end
end
output
end
def run_test_file(file)
run %Q(ruby -I"lib:test" -rubygems #{file})
end
def run_all_tests
run "rake test"
end
def related_test_files(path)
Dir['test/**/*.rb'].select { |file| file =~ /test_#{File.basename(path)}/ }
end
watch('test/test_helper\.rb') { system('clear'); run_all_tests }
watch('test/.*test_.*\.rb') { |m| system('clear'); run_test_file(m[0]) }
watch('lib/.*') { |m| related_test_files(m[0]).each { |file| run_test_file(file) } }
# Ctrl-\
Signal.trap('QUIT') do
puts " --- Running all tests ---\n\n"
run_all_tests
end
# Ctrl-C
Signal.trap('INT') { abort("\n") }
Jump to Line
Something went wrong with that request. Please try again.