1
0
Fork 0
mirror of https://github.com/ms-ati/docile synced 2023-03-27 23:21:52 -04:00

Fix SimpleCov statistics, now that it depends on Docile

Need to un-require and then re-require Docile after SimpleCov is
loaded, so that it can measure test coverage of the library. This
is necessary since SimpleCov began to ship with Docile as a
dependency.
This commit is contained in:
Marc Siegel 2014-02-21 15:10:13 -05:00
parent 9ad1275b27
commit 389d2800fa

View file

@ -1,26 +1,30 @@
require 'rubygems'
require 'rspec'
require 'singleton'
require 'simplecov'
require 'coveralls'
# Both local SimpleCov and publish to Coveralls.io
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter "/spec/"
# On Ruby 1.9+ use SimpleCov and publish to Coveralls.io
if !RUBY_VERSION.start_with? '1.8'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter "/spec/"
end
# Remove Docile, which was required by SimpleCov, to require again later
Object.send(:remove_const, :Docile)
$LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
end
test_dir = File.dirname(__FILE__)
$LOAD_PATH.unshift test_dir unless $LOAD_PATH.include?(test_dir)
lib_dir = File.join(File.dirname(test_dir), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include?(lib_dir)
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
# Require Docile again, now with coverage enabled on 1.9+
require 'docile'
require 'singleton'
require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect