forked from sds/overcommit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate_dir_spec.rb
31 lines (26 loc) · 1.08 KB
/
template_dir_spec.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
require 'spec_helper'
describe 'template directory' do
let(:template_dir) { File.join(Overcommit::HOME, 'template-dir') }
let(:hooks_dir) { File.join(template_dir, 'hooks') }
it 'contains a hooks directory' do
File.directory?(hooks_dir).should == true
end
describe 'the hooks directory' do
it 'contains the master hook as an actual file with content' do
master_hook = File.join(hooks_dir, 'overcommit-hook')
File.exist?(master_hook).should == true
File.size?(master_hook).should > 0
Overcommit::Utils::FileUtils.symlink?(master_hook).should == false
end
it 'contains all other hooks as symlinks to the master hook' do
if Overcommit::OS.windows?
# Symlinks in template-dir are not compatible with Windows.
# Windows users will need to manually install Overcommit for now.
skip 'Unix symlinks not compatible with Windows'
end
Overcommit::Utils.supported_hook_types.each do |hook_type|
Overcommit::Utils::FileUtils.symlink?(File.join(hooks_dir, hook_type)).should == true
end
end
end
end