Test: add simplecov

This commit is contained in:
Colin Darie 2018-06-02 15:44:34 +02:00
parent cc4d2a11a7
commit 9acb74f610
No known key found for this signature in database
GPG Key ID: 4FB865FDBCA4BCC4
6 changed files with 30 additions and 2 deletions

6
.gitignore vendored
View File

@ -35,3 +35,9 @@ yarn-debug.log*
.yarn-integrity
/config/deploy/config.yml
# SimpleCov coverage output
/coverage
# OS file
.DS_Store

View File

@ -23,5 +23,5 @@ install:
script:
- bundle exec rubocop
- bundle exec rails test
- bundle exec rails test:system
- bundle exec rails test NO_COVERAGE=1
- bundle exec rails test:system NO_COVERAGE=1

View File

@ -81,6 +81,7 @@ group :test do
gem 'launchy'
gem "database_cleaner"
gem "simplecov", require: false
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem

View File

@ -104,6 +104,7 @@ GEM
warden (~> 1.2.3)
devise-i18n (1.6.2)
devise (>= 4.4)
docile (1.3.1)
erubi (1.7.1)
execjs (2.7.0)
factory_bot (4.10.0)
@ -134,6 +135,7 @@ GEM
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
json (2.1.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.6.0)
@ -259,6 +261,11 @@ GEM
simple_form (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
@ -339,6 +346,7 @@ DEPENDENCIES
sass-rails (~> 5.0)
selenium-webdriver
simple_form (~> 4.0)
simplecov
spring
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)

View File

@ -34,6 +34,7 @@ class SystemCommand
private
# :nocov:
def call(cmd)
pid, _, stdout, stderr = Open4.popen4 cmd
_, status = Process.waitpid2 pid
@ -45,6 +46,7 @@ class SystemCommand
stderr.read.strip,
)
end
# :nocov:
def escape_arg(arg)
arg.to_s.gsub('"') { '\"' }

View File

@ -1,4 +1,15 @@
ENV["RAILS_ENV"] ||= "test"
require "pry"
if !ENV["NO_COVERAGE"] && (ARGV.empty? || ARGV.include?("test/test_helper.rb"))
require "simplecov"
SimpleCov.start "rails" do
add_group "Services", "app/services"
add_group "Notifier", "app/notifier"
add_group "Policies", "app/policies"
end
end
require_relative "../config/environment"
require "rails/test_help"