-
Notifications
You must be signed in to change notification settings - Fork 32
/
spec_helper.rb
29 lines (24 loc) · 988 Bytes
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require File.expand_path("on_what", File.dirname(File.dirname(__FILE__)))
# Code coverage (via SimpleCov)
begin
require "simplecov"
SimpleCov.start do
add_filter "/spec/" # exclude test code
add_filter "/vendor/" # exclude gems which are vendored on Travis CI
add_filter "/on_what.rb" # exclude help used only in gemspec
end
# On CI we publish simplecov results to codecov.io
if on_travis?
require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
# Due to circular dependency (simplecov depends on docile), remove docile and require again below
Object.send(:remove_const, :Docile)
$LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
rescue LoadError
warn "warning: simplecov or codecov 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
# Require Docile again, now with coverage enabled
require "docile"