From 8c20e706f6495f3b4b1574d5df23a6d78044eb43 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Fri, 4 May 2018 11:25:01 +0200 Subject: [PATCH] Add simplecov for coverage reporting --- .gitignore | 3 +++ Gemfile | 2 ++ Gemfile.lock | 15 +++++++++++++++ spec/spec_helper.rb | 15 +++++++++++++++ 4 files changed, 35 insertions(+) diff --git a/.gitignore b/.gitignore index c8eaac69c..a2e772adb 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ # Ignore Ruby selection tools /.rvmrc /.rbenv + +# Ignore coverage report results +/coverage diff --git a/Gemfile b/Gemfile index 2b48324a7..d2feb6252 100644 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,8 @@ group :development, :test do gem 'nokogiri' gem 'rails-controller-testing' gem 'listen' + gem 'simplecov' + gem 'simplecov-console' end group :postgresql do diff --git a/Gemfile.lock b/Gemfile.lock index b8269c755..8b9073e30 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,6 +42,7 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + ansi (1.5.0) arel (9.0.0) bindex (0.5.0) bootsnap (1.3.0) @@ -56,6 +57,7 @@ GEM activerecord (>= 3.0, < 5.3) delayed_job (>= 3.0, < 5) diff-lcs (1.3) + docile (1.3.0) erubi (1.7.1) erubis (2.7.0) eventmachine (1.2.6) @@ -80,6 +82,7 @@ GEM has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) + hirb (0.7.3) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -98,6 +101,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) + json (2.1.0) json_pure (2.1.0) libv8 (3.16.14.19) listen (3.1.5) @@ -209,6 +213,15 @@ GEM sexp_processor (4.11.0) shoulda-matchers (3.1.2) activesupport (>= 4.0.0) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-console (0.4.2) + ansi + hirb + simplecov + simplecov-html (0.10.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -276,6 +289,8 @@ DEPENDENCIES safe_yaml sass-rails shoulda-matchers + simplecov + simplecov-console sqlite3 therubyracer thin diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c7ebc7969..f93ecd66e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,20 @@ $LOAD_PATH.push File.dirname(__FILE__) +# Start collecting data for test coverage report +require 'simplecov' +require 'simplecov-console' +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console, +]) +SimpleCov.start 'rails' do + + add_filter '/spec/' + add_filter '/.bundle/' + add_filter '/vendor/' + add_group 'Tasks', "lib/tasks" +end + # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] = "test"