From 78334e4a6bc126a522ab183b890bd652d1239de1 Mon Sep 17 00:00:00 2001 From: Charles de Bueger Date: Fri, 10 Apr 2020 22:50:47 +0100 Subject: [PATCH] Add SimpleCov --- .gitignore | 1 + Gemfile | 12 +++++++++--- Gemfile.lock | 6 ++++++ spec/rails_helper.rb | 12 ++++++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2cae7d4..aab352d 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ # application specific database.yml examples.txt +coverage /public/packs /public/packs-test diff --git a/Gemfile b/Gemfile index 28bcfd5..29e9288 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } @@ -33,16 +35,20 @@ gem 'jquery-rails' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] + gem 'byebug', platforms: %i[mri mingw x64_mingw] + gem 'factory_bot_rails' gem 'rspec-rails' gem 'shoulda-matchers' - gem 'factory_bot_rails' +end + +group :test do + gem 'simplecov', require: false end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' + gem 'web-console', '>= 3.3.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 98ab681..7e679b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,6 +70,7 @@ GEM concurrent-ruby (1.1.6) crass (1.0.6) diff-lcs (1.3) + docile (1.3.2) erubi (1.9.0) execjs (2.7.0) factory_bot (5.1.2) @@ -177,6 +178,10 @@ GEM tilt shoulda-matchers (4.3.0) activesupport (>= 4.2.0) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) spring (2.1.0) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -227,6 +232,7 @@ DEPENDENCIES rspec-rails sass-rails (>= 6) shoulda-matchers + simplecov spring spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6ce708d..14db989 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,9 +1,17 @@ +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' + +require 'simplecov' +SimpleCov.start 'rails' + require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production -abort('The Rails environment is running in production mode!') if Rails.env.production? +if Rails.env.production? + abort('The Rails environment is running in production mode!') +end require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! require 'support/factory_bot' @@ -69,4 +77,4 @@ with.test_framework :rspec with.library :rails end -end \ No newline at end of file +end