-
-
Save levicole/337044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\n--- watchr initialized ---\n\n" | |
def cmd() 'script/spec '; end | |
def run_all_specs | |
system(cmd + 'spec/') | |
end | |
def run_spec(spec) | |
puts "Running #{spec}" | |
system(cmd + spec) | |
puts | |
end | |
watch('^spec\/.*\/.*_spec\.rb') {|md| run_spec(md[0]) } | |
watch('^app/(.*)\.rb') {|md| run_spec("spec/#{md[1]}_spec.rb") } | |
watch('spec/spec_helper.rb') {|md| run_all_specs } | |
# Ctrl-\ | |
Signal.trap('QUIT') do | |
puts "\n--- Running all tests ---\n" | |
run_all_specs | |
puts | |
end | |
# Ctrl-C | |
Signal.trap('INT') { abort("\n") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment