foodsoft/spec/support/coverage.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

26 lines
1,003 B
Ruby

# optional test coverage
# needs to be loaded first, e.g. add a require at top of spec_helper
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 !(source_file.filename =~ %r{/lib/foodsoft_.*/})
end
SimpleCov.start do
add_filter '/spec/'
add_filter '/test/'
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 =~ %r{/lib/foodsoft_.*/} end
end
end