2012-10-08 21:14:37 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'bundler'
|
|
|
|
Bundler.setup(:default, :test)
|
|
|
|
|
|
|
|
# add project lib directory to load path
|
|
|
|
spec_pathname = Pathname.new(__FILE__).dirname
|
|
|
|
root_pathname = spec_pathname.join('..').expand_path
|
|
|
|
lib_pathname = root_pathname.join('lib')
|
|
|
|
$LOAD_PATH.unshift(lib_pathname.to_s)
|
|
|
|
|
2012-11-06 22:30:41 +00:00
|
|
|
# must be first require and started before any other requires so that it can measure coverage of all following required
|
|
|
|
# code. It is after the rubygems and bundler only because Bundler.setup supplies the LOAD_PATH to simplecov.
|
|
|
|
require 'simplecov'
|
2012-11-08 19:22:07 +00:00
|
|
|
# Ensure the coverage directory is always the same no matter where the individual spec is in the hierarchy when using
|
|
|
|
# Rubymine to run one spec.
|
|
|
|
#
|
|
|
|
# @see https://github.com/colszowka/simplecov/issues/95
|
|
|
|
SimpleCov.root(root_pathname)
|
2012-11-06 22:30:41 +00:00
|
|
|
SimpleCov.start
|
|
|
|
|
2012-10-08 21:14:37 +00:00
|
|
|
require 'rspec/core'
|
|
|
|
|
|
|
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
|
|
# in spec/support/ and its subdirectories.
|
|
|
|
support_glob = root_pathname.join('spec', 'support', '**', '*.rb')
|
|
|
|
|
|
|
|
Dir.glob(support_glob) do |path|
|
|
|
|
require path
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.mock_with :rspec
|
|
|
|
end
|
|
|
|
|