I am attempting to get RCov to work 开发者_StackOverflow社区with my RSpec and Shoulda test for a rails 3 app. It seems to work fine with my RSpec after using the Rake task below but all of the shoulda tests fail and I cant seem to find any documentation on getting these to work. They all run fine under autotest(rspec and shoulda).
namespace :spec do
desc "Run specs with RCov"
RSpec::Core::RakeTask.new('rcov' ) do |t|
#t.spec_files = FileList['spec/**/*_spec.rb' ]
t.rcov = true
t.rcov_opts = ['--exclude' , '\/Library\/Ruby' ]
end
end
What version of Ruby are you using?
I've found that Rcov doesn't work so well with Ruby 1.9, although last I checked was about 2 months ago.
I've switched over to cover_me, which is built on top of Rcov (I believe), and was built for Ruby 1.9.
I haven't had any problems with it so far, and it's easily installed. Haven't tried it with Shoulda, but works great in Ruby 1.9, Rails 3, and Rspec 2.
Here's the link if you're interested: https://github.com/markbates/cover_me
精彩评论