Updated test:coverage rake task to use simplecov

This commit is contained in:
Iain Beeston 2016-10-28 17:08:52 +01:00
parent af6dad2a6c
commit 138a7be690
4 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/pkg
/doc/api
/Gemfile.lock
/coverage

View File

@ -54,6 +54,7 @@ if RUBY_ENGINE == "ruby"
gem 'sass'
gem 'reel-rack'
gem 'celluloid', '~> 0.16.0'
gem 'simplecov', require: false
end
if RUBY_ENGINE == "rbx"

View File

@ -55,7 +55,8 @@ namespace :test do
desc 'Measures test coverage'
task :coverage do
rm_f "coverage"
sh "rcov -Ilib test/*_test.rb"
ENV['COVERAGE'] = '1'
Rake::Task['test'].invoke
end
end

View File

@ -1,3 +1,12 @@
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.start do
add_filter '/test/'
add_group 'sinatra-contrib', 'sinatra-contrib'
add_group 'rack-protection', 'rack-protection'
end
end
ENV['APP_ENV'] = 'test'
Encoding.default_external = "UTF-8" if defined? Encoding