Browse files

Add test coverage via rcov

  • Loading branch information...
1 parent fa5ef1b commit b2db5269f0da3aa31a1565a3791610aff4f69974 @mperham mperham committed Dec 1, 2008
Showing with 18 additions and 0 deletions.
  1. +18 −0 Rakefile
View
18 Rakefile
@@ -87,3 +87,21 @@ def create_mysql(create, db_name)
execute "create table the_whole_burritos (id integer not null auto_increment, name varchar(30) not null, primary key(id))"
execute "insert into the_whole_burritos (id, name) values (1, '#{db_name}')"
end
+
+# Test coverage
+begin
+ gem 'spicycode-rcov'
+ require 'rcov/rcovtask'
+
+ task :cover => [:pretest, :rcov]
+
+ Rcov::RcovTask.new('rcov') do |t|
+ t.libs << "test"
+ t.test_files = FileList["test/*_test.rb"]
+ t.output_dir = "coverage"
+ t.verbose = true
+ t.rcov_opts = ['--text-report', '--exclude', "test,Library,#{ENV['GEM_HOME']}", '--sort', 'coverage']
+ end
+rescue GemError => e
+ puts 'Test coverage support requires \'gem install spicycode-rcov\''
+end

0 comments on commit b2db526

Please sign in to comment.