Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RCov with RSpec-2

Tags:

rspec

rcov

I'm working with a bit of a bleeding edge rails app. Rails 3, RSpec 2, Rspec-Rails2.

It seems as if RSpec2 doesn't include the spec:rcov rake task that RSpec 1 has. (at least it isn't there yet)

Has anyone had any luck running rcov with rspec 2, or writing their own rake task to make this work?

like image 610
JoshReedSchramm Avatar asked Jun 17 '10 03:06

JoshReedSchramm


2 Answers

Try passing in options to exclude the gem directory. Or since your running rails use the rails flag:

desc  "Run all specs with rcov"
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
  t.rcov = true
  t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/}
end
like image 83
Nick L Avatar answered Nov 23 '22 21:11

Nick L


If you happen to be on Ruby 1.9x, I just got CoverMe (an rcov-ish lib that works under 1.9) working. Snappy and works out of the box w/ RSpec -- pretty much a plug-n-play setup. It just silently does your /coverage stuff every time you run rake:spec. Thought I'd mention it since I'm running 1.9.2preview3 on my bleeding edge stuff and it's possible you'll run into some 1.9 issues if you're using it.

like image 27
trevrosen Avatar answered Nov 23 '22 21:11

trevrosen