From eab62e5a97f3aa1827fb5078e63a76908c2e51bc Mon Sep 17 00:00:00 2001
From: Lucas Nussbaum <lucas.nussbaum@loria.fr>
Date: Sun, 22 Sep 2019 18:13:11 +0200
Subject: [PATCH] Add a spec_helper file that loads simplecov to output a
 coverage report

---
 .gitignore                   | 1 +
 Gemfile                      | 3 ++-
 Gemfile.lock                 | 7 +++++++
 tests/oar_properties_spec.rb | 2 ++
 tests/spec_helper.rb         | 9 +++++++++
 5 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec_helper.rb

diff --git a/.gitignore b/.gitignore
index 288e369e8c2..2d1063449ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ bundle
 .bundle
 vendor
 /tmp
+coverage
diff --git a/Gemfile b/Gemfile
index c6da111ccad..5487076341c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,4 +10,5 @@ gem "ruby-cute", :require => "cute"
 gem "peach"
 gem "restfully"
 gem "rspec"
-gem "webmock"
\ No newline at end of file
+gem "webmock"
+gem "simplecov"
diff --git a/Gemfile.lock b/Gemfile.lock
index f821a002ad9..b92256af24d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -10,6 +10,7 @@ GEM
     diff-lcs (1.3)
     diffy (3.3.0)
     dns-zone (0.3.1)
+    docile (1.3.2)
     domain_name (0.5.20190701)
       unf (>= 0.0.5, < 1.0.0)
     faraday (0.15.4)
@@ -93,6 +94,11 @@ GEM
       net-ssh-multi (>= 1.2)
       rest-client (>= 1.6)
     safe_yaml (1.0.5)
+    simplecov (0.17.1)
+      docile (~> 1.1)
+      json (>= 1.8, < 3)
+      simplecov-html (~> 0.10.0)
+    simplecov-html (0.10.2)
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.7.6)
@@ -115,4 +121,5 @@ DEPENDENCIES
   restfully
   rspec
   ruby-cute
+  simplecov
   webmock
diff --git a/tests/oar_properties_spec.rb b/tests/oar_properties_spec.rb
index ad1bffd5317..0039cb79a1f 100644
--- a/tests/oar_properties_spec.rb
+++ b/tests/oar_properties_spec.rb
@@ -1,3 +1,5 @@
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
+require 'spec_helper'
 require 'rspec'
 require 'webmock/rspec'
 
diff --git a/tests/spec_helper.rb b/tests/spec_helper.rb
new file mode 100644
index 00000000000..f0876afe762
--- /dev/null
+++ b/tests/spec_helper.rb
@@ -0,0 +1,9 @@
+require 'simplecov'
+
+SimpleCov.start do
+  add_filter '/tests/'
+  add_filter '/bundle/'
+end
+# This outputs the report to your public folder
+# You will want to add this to .gitignore
+SimpleCov.coverage_dir 'coverage'
-- 
GitLab