Jeremy Durham

Ruby, Rails, and everything in between.

  • BlogThoughts
  • AboutAbout the Author
  • ContactGet in touch

November 30, 2009 00:20
Posted by Jeremy Durham

rspec + cucumber + rcov

I had to do a bit of running around to get Rspec, Cucumber, and rcov working together nicely; here’s my current rake task:

require 'cucumber/rake/task'
require 'spec/rake/spectask'
 
namespace :rcov do
  Cucumber::Rake::Task.new(:cucumber) do |t|    
    t.rcov = true
    t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
    t.rcov_opts << %[-o "coverage"]
  end
 
  Spec::Rake::SpecTask.new(:rspec) do |t|
    t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
    t.spec_files = FileList['spec/**/*_spec.rb']
    t.rcov = true
    t.rcov_opts = lambda do
      IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
    end
  end
 
  desc "Run both specs and features to generate aggregated coverage"
  task :all do |t|
    rm "coverage.data" if File.exist?("coverage.data")
    Rake::Task['rcov:rspec'].invoke
    Rake::Task["rcov:cucumber"].invoke
  end
end

Running rake rcov:all should give you nice coverage data that includes both rspec and cucumber.

No Comments

Posted Under Programming

0 Comments

Leave a comment

* = Required
  • Posts
  • Twitter
  • Flickr
 

DNS-321 + OpenVPN...

Technology

 

There is no Holy ...

Technology

 

Google and Apple:...

Technology

Am I the only one who thinks that the Ruby Motion video only outputs on the left channel? #annoying

follow me on
twitter

125942640_a3dcc3f951_s125942637_c4524c7c88_s125942628_a682f8a639_s122144184_5f2dd86929_s122144182_1b01ded312_s122144181_893a82f1d3_s122144179_70465b00ff_s122102402_21e6174af6_s122102401_f6d9ebff55_s

Categories

  • Technology
  • Programming
  • Family
  • Travel

This site is using the Handgloves WordPress Theme
Designed & Developed by George Wiscombe

Subscribe via RSS