Permalink
Browse files

Add built-in support for code coverage via SimpleCov.

rcov no longer works with MRI 1.9
  • Loading branch information...
1 parent 5a7a635 commit 7b29c68a9d75a56b3d32e5a01c9311516755377b @neilconway neilconway committed Jul 22, 2012
Showing with 14 additions and 1 deletion.
  1. +5 −0 README.md
  2. +9 −1 test/test_common.rb
View
@@ -37,6 +37,11 @@ To run the unit tests:
% gem install minitest # unless already installed
% cd test; ruby ts_bud.rb
+To run the unit tests and produce a code coverage report:
+
+ % gem install simplecov # unless already installed
+ % cd test; COVERAGE=1 ruby ts_bud.rb
+
## Optional Dependencies
The bud gem has a handful of mandatory dependencies. It also has one optional
View
@@ -1,8 +1,16 @@
+require 'rubygems'
+
+if ENV["COVERAGE"]
+ require 'simplecov'
+ SimpleCov.command_name 'minitest'
+ SimpleCov.root '../'
+ SimpleCov.start
+end
+
# Prefer Bud from local source tree to any version in RubyGems
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
$:.unshift "."
require 'bud'
-require 'rubygems'
gem 'minitest' # Use the rubygems version of MT, not builtin (if on 1.9)
require 'minitest/autorun'

0 comments on commit 7b29c68

Please sign in to comment.