|
|
282a95 |
From cfd0933a6b784ac6bdca867777600137ff49ba5e Mon Sep 17 00:00:00 2001
|
|
|
282a95 |
From: Ken Dreyer <ktdreyer@ktdreyer.com>
|
|
|
282a95 |
Date: Tue, 24 Mar 2015 16:38:37 -0600
|
|
|
282a95 |
Subject: [PATCH] tests: make simplecov/coveralls optional
|
|
|
282a95 |
|
|
|
282a95 |
If we do not have SimpleCov or Coveralls installed, we should be able to
|
|
|
282a95 |
continue with the rest of the test suite.
|
|
|
282a95 |
|
|
|
282a95 |
This allows the tests to run outside of Bundler if SimpleCov or
|
|
|
282a95 |
Coveralls are not installed.
|
|
|
282a95 |
---
|
|
|
282a95 |
test/test_helper.rb | 42 +++++++++++++++++++++++-------------------
|
|
|
282a95 |
1 file changed, 23 insertions(+), 19 deletions(-)
|
|
|
282a95 |
|
|
|
282a95 |
diff --git a/test/test_helper.rb b/test/test_helper.rb
|
|
|
282a95 |
index 443aaae..3ddfce7 100644
|
|
|
282a95 |
--- a/test/test_helper.rb
|
|
|
282a95 |
+++ b/test/test_helper.rb
|
|
|
282a95 |
@@ -1,23 +1,27 @@
|
|
|
282a95 |
unless defined?(JRUBY_VERSION)
|
|
|
282a95 |
- require 'simplecov'
|
|
|
282a95 |
- require 'coveralls'
|
|
|
282a95 |
-
|
|
|
282a95 |
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
|
282a95 |
- SimpleCov::Formatter::HTMLFormatter,
|
|
|
282a95 |
- Coveralls::SimpleCov::Formatter
|
|
|
282a95 |
- ]
|
|
|
282a95 |
-
|
|
|
282a95 |
- SimpleCov.start do
|
|
|
282a95 |
- project_name 'thread_safe'
|
|
|
282a95 |
-
|
|
|
282a95 |
- add_filter '/examples/'
|
|
|
282a95 |
- add_filter '/pkg/'
|
|
|
282a95 |
- add_filter '/test/'
|
|
|
282a95 |
- add_filter '/tasks/'
|
|
|
282a95 |
- add_filter '/yard-template/'
|
|
|
282a95 |
- add_filter '/yardoc/'
|
|
|
282a95 |
-
|
|
|
282a95 |
- command_name 'Mintest'
|
|
|
282a95 |
+ begin
|
|
|
282a95 |
+ require 'simplecov'
|
|
|
282a95 |
+ require 'coveralls'
|
|
|
282a95 |
+
|
|
|
282a95 |
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
|
282a95 |
+ SimpleCov::Formatter::HTMLFormatter,
|
|
|
282a95 |
+ Coveralls::SimpleCov::Formatter
|
|
|
282a95 |
+ ]
|
|
|
282a95 |
+
|
|
|
282a95 |
+ SimpleCov.start do
|
|
|
282a95 |
+ project_name 'thread_safe'
|
|
|
282a95 |
+
|
|
|
282a95 |
+ add_filter '/examples/'
|
|
|
282a95 |
+ add_filter '/pkg/'
|
|
|
282a95 |
+ add_filter '/test/'
|
|
|
282a95 |
+ add_filter '/tasks/'
|
|
|
282a95 |
+ add_filter '/yard-template/'
|
|
|
282a95 |
+ add_filter '/yardoc/'
|
|
|
282a95 |
+
|
|
|
282a95 |
+ command_name 'Mintest'
|
|
|
282a95 |
+ end
|
|
|
282a95 |
+ rescue LoadError
|
|
|
282a95 |
+ warn "warning: simplecov/coveralls gems not found; skipping coverage"
|
|
|
282a95 |
end
|
|
|
282a95 |
end
|
|
|
282a95 |
|
|
|
282a95 |
--
|
|
|
282a95 |
1.9.3
|
|
|
282a95 |
|