def run_spec(file) unless File.exists?(file) puts "#{file} does not exist" return end puts "Running #{file}" system "bundle exec rspec --format documentation #{file}" puts "*"*72 end watch("spec/.*/*_spec.rb") do |match| run_spec(match[0]) end watch("app/(.*/.*).rb") do |match| run_spec %{spec/#{match[1]}_spec.rb} end