forked from sds/overcommit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec_helper.rb
50 lines (42 loc) · 1.35 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if ENV['TRAVIS']
# When running in Travis, report coverage stats to Coveralls.
require 'coveralls'
Coveralls.wear!
else
# Otherwise render coverage information in coverage/index.html and display
# coverage percentage in the console.
require 'simplecov'
end
require 'overcommit'
require 'tempfile'
hook_types = Dir[File.join(Overcommit::HOOK_DIRECTORY, '*')].
select { |f| File.directory?(f) }.
reject { |f| File.basename(f) == 'shared' }.
sort
hook_types.each do |hook_type|
require File.join(hook_type, 'base.rb')
Dir[File.join(hook_type, '**/*.rb')].
select { |f| File.file?(f) && File.basename(f, '.rb') != 'base' }.
sort.
each { |f| require f }
end
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
RSpec.configure do |config|
config.include GitSpecHelpers
config.include OutputHelpers
config.include ShellHelpers
# Continue to enable the older `should` syntax for expectations
config.expect_with :rspec do |c|
c.syntax = [:expect, :should]
end
config.mock_with :rspec do |c|
c.syntax = :should
end
# Much of Overcommit depends on these helpers, so they are aggressively
# cached. Unset them before each example so we always get fresh values.
config.before(:each) do
%w[git_dir repo_root].each do |var|
Overcommit::Utils.instance_variable_set(:"@#{var}", nil)
end
end
end