Skip to content
This repository
tag: v1.2.5
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (26 sloc) 0.625 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# Watchr is the preferred method to run specs automatically over rspactor for
# Mongoid. If you are using vim, you can add the file:
#
# ~/.vim/ftdetect/watchr.vim
#
# This should have only the following line in it:
#
# autocmd BufNewFile,BufRead *.watchr setf ruby
#
# This will enable vim to recognize this file as ruby code should you wish to
# edit it.
def run(cmd)
  puts cmd
  system cmd
end

def spec(file)
  run "spec -O spec/spec.opts #{file}"
end

watch("spec/.*/*_spec\.rb") do |match|
  p match[0]
  spec(match[0])
end

watch('lib/(.*/.*)\.rb') do |match|
  p match[1]
  spec("spec/unit/#{match[1]}_spec.rb")
end
Something went wrong with that request. Please try again.