-
-
Save skuroki/1333244 to your computer and use it in GitHub Desktop.
watchr for rspec
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
def run(cmd) | |
puts(cmd) | |
system(cmd) | |
puts 'Finished. ' + Time.now.to_s | |
end | |
def run_single_spec (*spec) | |
spec = spec.join(' ') | |
run "rspec -bX #{spec}" | |
end | |
# -------------------------------------------------- | |
# Watchr Rules | |
# -------------------------------------------------- | |
watch( '^spec/requests/.*_spec\.rb' ) { |m| run_single_spec(m[0]) } | |
watch( '^spec/.*_spec\.rb' ) { |m| run_single_spec(m[0]) } | |
watch( '^app/(.*)\.rb' ) { |m| run_single_spec("spec/%s_spec.rb" % m[1]) } | |
watch( '^app/views/(.*)\.erb' ) { |m| run_single_spec("spec/views/%s.erb_spec.rb" % m[1]) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment