-
Notifications
You must be signed in to change notification settings - Fork 3
/
autotest
22 lines (19 loc) · 816 Bytes
/
autotest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# vim:filetype=ruby
%w[autotest/growl autotest/timestamp autotest/redgreen].each {|l| require l}
# Ignore some dirs (speed hack)
Autotest.add_hook :initialize do |autotest|
[/\.svn/, /\.hg/, /\.git/, /^\.\/vendor/, /^\.\/doc/].each {|exception| autotest.add_exception(exception)}
end
# If called with arg, watch that dir and matching test dir
Autotest.add_hook :initialize do |at|
unless ARGV.empty?
if File.directory?("spec")
at.find_directories = ARGV.length == 1 ? ["spec/#{ARGV.first}","app/#{ARGV.first}"] : ARGV.dup
else
at.find_directories = ARGV.length == 1 ? ["test/#{{ "models" => "unit", "controllers" => "functional", }[ARGV.first]}","app/#{ARGV.first}"] : ARGV.dup
end
end
# at.add_mapping(/.rb$/) do |f, _|
# at.files_matching(/^spec\/.*_spec\.rb$/)
# end
end