diff --git a/.gitignore b/.gitignore index fc929a2bd..bc37c48a0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ npm-debug.log # Using yarn rather than npm package-lock.json +coverage diff --git a/Gemfile b/Gemfile index 7e881ba28..e0023e149 100644 --- a/Gemfile +++ b/Gemfile @@ -48,6 +48,7 @@ group :development, :test do gem 'awesome_print' gem 'vcr' gem 'rails-controller-testing' + gem 'simplecov', require: false end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index ab0013e34..c6ec08fed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.3) + docile (1.3.1) dotenv (2.2.1) dotenv-rails (2.2.1) dotenv (= 2.2.1) @@ -266,6 +267,11 @@ GEM childprocess (~> 0.5) rubyzip (~> 1.0) sexp_processor (4.11.0) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) slim (3.0.8) temple (>= 0.7.6, < 0.9) tilt (>= 1.3.3, < 2.1) @@ -355,6 +361,7 @@ DEPENDENCIES rubocop sass-rails (~> 5.0) selenium-webdriver + simplecov slim-rails (~> 3.1) spring spring-watcher-listen (~> 2.0.0) diff --git a/bin/rails b/bin/rails index 5badb2fde..ce1b1d67a 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,9 @@ #!/usr/bin/env ruby +if ENV['RAILS_ENV'] == 'test' + require 'simplecov' + SimpleCov.start 'rails' + puts "required simplecov" +end begin load File.expand_path('../spring', __FILE__) rescue LoadError => e diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index fd0e41506..051cab7ec 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'simplecov' +SimpleCov.start 'rails' # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test'