[rspec-users] RSpec 0.7.5 with Rails and rcov

Jonathan Tron jonathan.tron.mailings at gmail.com
Fri Jan 5 04:47:58 EST 2007

Le 5 janv. 07 à 03:05, Bryan Liles a écrit :

> I seem to be missing something because I am at a loss on how to get
> rcov, RSpec, and Rails working together.  Would someone mind dropping
> some hints?

I don't know what you want to achieve, but if your goal is to  
generate some reports here's what I added to lib/tasks/ 
rspec_additions.rake :

namespace :spec do
   desc "Spec with rspec/rcov reports"
   Spec::Rake::SpecTask.new('reports') do |t|
     t.spec_files = FileList['spec/**/*.rb']
     t.spec_opts = ["--format", "html", "--diff"]
     t.out = 'doc/rspec.html'
     t.rcov = true
     t.rcov_dir = 'doc/coverage'

# Optional :
# Prevent rcov to generate report on specs, environment.rb and boot.rb
#    t.rcov_opts = ['--exclude', 'spec,config\/environment.rb,config\/ 

     t.fail_on_error = false
     t.failure_message = "The specs failed. Check for the problem at  

Run it with rake : spec:reports
It will generate rspec.html report in doc/rspec.html and rcov report  
in doc/coverage/.

Tron Jonathan

More information about the rspec-users mailing list