Permalink
Browse files

Documents nuances of using rcov with rspec

* Closes #479
* Closes #551
* Closes #719
  • Loading branch information...
1 parent 5f6e715 commit f4425613fefd262c64b6ad7388be2f6de1f54199 @charlietanksley charlietanksley committed with alindeman Oct 27, 2012
Showing with 25 additions and 0 deletions.
  1. +22 −0 README.md
  2. +3 −0 lib/rspec/core/rake_task.rb
View
@@ -167,6 +167,28 @@ the command line.
rspec-core ships with an Autotest extension, which is loaded automatically if
there is a `.rspec` file in the project's root directory.
+## rcov integration
+
+rcov is best integrated via the [rcov rake
+task](http://www.rubydoc.info/github/relevance/rcov/master/Rcov/RcovTask).
+
+rcov can also be integrated via the rspec rake task, but it requires a bit
+more setup:
+
+```ruby
+# Rakefile
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec) do |config|
+ config.rcov = true
+end
+
+task :default => :spec
+
+# spec/spec_helper.rb
+require 'rspec/autorun' # **add this**
+```
+
## get started
Start with a simple example of behavior you expect from your system. Do
@@ -62,6 +62,9 @@ def warning=(true_or_false)
# Use rcov for code coverage?
#
+ # Due to the many ways `rcov` can run, if this option is enabled, it is
+ # required that `require 'rspec/autorun'` appears in `spec_helper`.rb
+ #
# default:
# false
attr_accessor :rcov

0 comments on commit f442561

Please sign in to comment.