require 'rubygems' require 'bundler/setup' #require 'test/unit' require 'rake/testtask' require 'rcov/rcovtask' # to get xunit test results: rake ci:setup:testunit test require 'ci/reporter/rake/test_unit' Bundler::GemHelper.install_tasks # integration test files INT_TEST_FILES = FileList['test/int_test*.rb'] # helper to dry up tasks def def_test(t, opts = {}) t.libs << "test" t.test_files = opts[:test_files] if opts[:test_files] t.rcov_opts += opts[:rcov_opts] if opts[:rcov_opts] t.verbose = true end Rake::TestTask.new do |t| def_test(t) end Rake::TestTask.new(:integration) do |t| def_test(t, :test_files => INT_TEST_FILES) end task :test_all => [ :test, :integration ] RCOV_OPTS = [ '--xrefs', # comment to disable cross-references '--html', '--exclude /gems/' ] # '-a' #desc "Create a cross-referenced code coverage report." Rcov::RcovTask.new do |t| def_test(t, :rcov_opts => RCOV_OPTS) end Rcov::RcovTask.new(:rcov_integration) do |t| def_test(t, :test_files => INT_TEST_FILES, :rcov_opts => RCOV_OPTS) end Rcov::RcovTask.new(:rcov_all) do |t| # test_files field not accessible on RcovTask? meh def_test(t, :test_files => FileList['test/test*.rb'] + INT_TEST_FILES, :rcov_opts => RCOV_OPTS) end