update coverage and use coveralls.io

This commit is contained in:
wvengen 2013-12-16 23:11:39 +01:00
parent 18c946eab1
commit 147365cba1
4 changed files with 34 additions and 7 deletions

View file

@ -3,6 +3,7 @@ rvm:
- 1.9.3
services:
- redis-server
env: COVERALLS=1
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

View file

@ -84,10 +84,12 @@ group :test do
# webkit and poltergeist don't seem to work yet
gem 'selenium-webdriver'
gem 'database_cleaner'
gem 'simplecov', require: false
# need to include rspec components before i18n-spec or rake fails in test environment
gem 'rspec-core'
gem 'rspec-expectations'
gem 'rspec-rerun'
gem 'i18n-spec'
# code coverage
gem 'simplecov', require: false
gem 'coveralls', require: false
end

View file

@ -102,6 +102,12 @@ GEM
execjs
coffee-script-source (1.6.3)
commonjs (0.2.7)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
daemons (1.1.9)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
@ -248,6 +254,8 @@ GEM
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
@ -306,6 +314,8 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.8)
term-ansicolor (1.2.2)
tins (~> 0.8)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
@ -315,6 +325,7 @@ GEM
rack (>= 1.0.0)
thor (0.18.1)
tilt (1.4.1)
tins (0.13.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
@ -357,6 +368,7 @@ DEPENDENCIES
client_side_validations
client_side_validations-simple_form
coffee-rails (~> 3.2.1)
coveralls
daemons
database_cleaner
exception_notification

View file

@ -1,14 +1,26 @@
# optional test coverage
# needs to be loaded first, e.g. add a require at top of spec_helper
if ENV['COVERAGE']
if ENV['COVERAGE'] or ENV['COVERALLS']
require 'simplecov'
# update coveralls.io on Travis CI
if ENV['COVERALLS']
require 'coveralls'
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
end
# slightly tweaked coverage reporting
def cov_no_plugins(source_file, path)
source_file.filename =~ /#{path}/ and not source_file.filename =~ /\/lib\/foodsoft_.*\//
end
SimpleCov.start do
add_filter '/spec/'
add_filter '/test/'
add_group 'Models', '/app/models/'
add_group 'Controllers', '/app/controllers/'
add_group 'Helpers', '/app/helpers/'
add_group 'Documents', '/app/documents/'
add_group 'Libraries', '/lib/'
add_group 'Models' do |s| cov_no_plugins s, '/app/models/' end
add_group 'Controllers' do |s| cov_no_plugins s, '/app/controllers/' end
add_group 'Helpers' do |s| cov_no_plugins s, '/app/helpers/' end
add_group 'Documents' do |s| cov_no_plugins s, '/app/documents/' end
add_group 'Libraries' do |s| cov_no_plugins s, '/lib/' end
add_group 'Plugins' do |s| s.filename =~ /\/lib\/foodsoft_.*\// end
end
end