-
Notifications
You must be signed in to change notification settings - Fork 280
/
Copy pathspec_helper.rb
39 lines (32 loc) · 1.06 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
require 'overcommit'
require 'tempfile'
hook_types = Dir[File.join(Overcommit::OVERCOMMIT_HOME, 'lib/overcommit/hook/*')].
select { |f| File.directory?(f) }.
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