tests: make simplecov/coveralls optional

If we do not have SimpleCov or Coveralls installed, we should be able to
continue with the rest of the test suite.

This allows the tests to run outside of Bundler if SimpleCov or
Coveralls are not installed.
This commit is contained in:
Ken Dreyer 2014-06-11 16:54:08 -06:00
parent 47489ab34b
commit 33834852c7
1 changed files with 20 additions and 16 deletions

View File

@ -1,3 +1,4 @@
begin
require 'simplecov'
require 'coveralls'
@ -16,6 +17,9 @@ if !RUBY_VERSION.start_with? '1.8'
Object.send(:remove_const, :Docile)
$LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
end
rescue LoadError
warn 'warning: simplecov/coveralls gems not found; skipping coverage'
end
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir