Skip to content

Instantly share code, notes, and snippets.

@johnbintz
Created December 13, 2010 16:34
Show Gist options
  • Save johnbintz/739193 to your computer and use it in GitHub Desktop.
Save johnbintz/739193 to your computer and use it in GitHub Desktop.
Run rcov with RSpec tests from the command line
def rcov(file = nil)
file = Dir['spec/**/*_spec.rb'].join(' ') if !file
system %{bundle exec ruby -Ilib -S rcov -x '/gems/,config/,spec/' -t $(which rspec) -- #{file}}
end
watch('app/(.*/.*)\.rb') { |m| rcov("spec/#{m[1]}_spec.rb") }
watch('spec/(.*/.*)_spec\.rb') { |m| rcov(m[0]) }
rcov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment