-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautotest
39 lines (31 loc) · 851 Bytes
/
autotest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'autotest/fsevent'
#require 'redgreen/autotest' if ENV['RSPEC'] != 'true'
require 'autotest/growl'
#require 'redgreen'
#$: << File.join(File.dirname(__FILE__), 'spec')
# SPEAKING = false
# DOOM_EDITION = false
# BUUF = false
# PENDING = false
# STICKY = false
# SUCCESS_SOUND = ''
# FAILURE_SOUND = ''
#run all tests for ANY file
Autotest.add_hook :initialize do |at|
unless ARGV.empty?
spec_dir = ENV['SPEC_EXT'] ? 'spec_ext' : 'spec'
at.clear_mappings
at.add_mapping(%r%^#{spec_dir}/.*/(.*)s?_spec.rb$%) { |filename, m|
if ARGV.include?(m[1])
filename
else
puts "skipping spec: #{filename}"
end
}
at.add_mapping(%r{^(app|lib)/.*/(.*)\.rb$}) { |_, m|
if ARGV.include?(m[2])
at.files_matching %r{^#{spec_dir}/.*/#{m[2]}_spec.rb$}
end
}
end
end