Permalink
Browse files

it's specs.watchr

  • Loading branch information...
1 parent c40aba3 commit 68ded0777791d52bbf99a03739d83f63f2dc399c @dchelimsky dchelimsky committed May 18, 2010
Showing with 10 additions and 10 deletions.
  1. +10 −10 specs.watchr
View
@@ -5,12 +5,12 @@
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
-def all_test_files
+def all_spec_files
Dir['spec/**/*_spec.rb']
end
-def run_test_matching(thing_to_match)
- matches = all_test_files.grep(/#{thing_to_match}/i)
+def run_spec_matching(thing_to_match)
+ matches = all_spec_files.grep(/#{thing_to_match}/i)
if matches.empty?
puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
else
@@ -24,17 +24,17 @@ def run(files_to_run)
no_int_for_you
end
-def run_all_tests
- run(all_test_files.join(' '))
+def run_all_specs
+ run(all_spec_files.join(' '))
end
# --------------------------------------------------
# Watchr Rules
# --------------------------------------------------
-watch('^spec/(.*)_spec\.rb') { |m| run_test_matching(m[1]) }
-watch('^lib/(.*)\.rb') { |m| run_test_matching(m[1]) }
-watch('^spec/spec_helper\.rb') { run_all_tests }
-watch('^spec/support/.*\.rb') { run_all_tests }
+watch('^spec/(.*)_spec\.rb') { |m| run_spec_matching(m[1]) }
+watch('^lib/(.*)\.rb') { |m| run_spec_matching(m[1]) }
+watch('^spec/spec_helper\.rb') { run_all_specs }
+watch('^spec/support/.*\.rb') { run_all_specs }
# --------------------------------------------------
# Signal Handling
@@ -52,7 +52,7 @@ Signal.trap 'INT' do
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
@sent_an_int = true
Kernel.sleep 1.5
- run_all_tests
+ run_all_specs
end
end

0 comments on commit 68ded07

Please sign in to comment.