docile/spec/spec_helper.rb

38 lines
1.0 KiB
Ruby
Raw Normal View History

begin
require 'simplecov'
require 'coveralls'
# 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/' # exclude test code
add_filter '/vendor/' # exclude gems which are vendored on Travis CI
end
2011-12-06 19:46:46 +00:00
# Remove Docile, which was required by SimpleCov, to require again later
Object.send(:remove_const, :Docile)
$LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
end
rescue LoadError
warn 'warning: simplecov/coveralls gems not found; skipping coverage'
end
2011-12-06 19:46:46 +00:00
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
2011-12-06 19:46:46 +00:00
# Require Docile again, now with coverage enabled on 1.9+
require 'docile'
2014-02-04 18:54:06 +00:00
require 'singleton'
require 'rspec'
2014-02-04 18:54:06 +00:00
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
end