21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-28 23:10:49 +02:00

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 .yarn-integrity
/config/deploy/config.yml /config/deploy/config.yml
# SimpleCov coverage output
/coverage
# OS file
.DS_Store

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,15 @@
ENV["RAILS_ENV"] ||= "test" 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_relative "../config/environment"
require "rails/test_help" require "rails/test_help"