Skip to content

Instantly share code, notes, and snippets.

@tonyto
Created April 25, 2011 10:23
Show Gist options
  • Save tonyto/940340 to your computer and use it in GitHub Desktop.
Save tonyto/940340 to your computer and use it in GitHub Desktop.
rspec watchr file
# watchr specs.watchr
watch( '^spec/(.*)\/(.*)\_spec.rb' ){ |m| run( "rspec spec/#{m[1]}/#{m[2]}_spec.rb") }
watch( '^(.*)\/(.*)\.rb') { |m| run( "rspec spec/#{m[1]}/#{m[2]}_spec.rb") }
watch( '(.*)\.rb' ) { |m| run( "rspec spec/#{m[1]}_spec.rb" ) }
watch( 'spec/(.*)\_spec.rb' ) { |m| run( "rspec spec/#{m[1]}_spec.rb" ) }
watch( '^spec/spec_helper\.rb' ) { run( "rspec spec" ) }
def run(cmd)
puts(cmd)
system(cmd)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment