forked from sds/overcommit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstalling_overcommit_spec.rb
37 lines (32 loc) · 1.16 KB
/
installing_overcommit_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
32
33
34
35
36
37
require 'spec_helper'
describe 'installing Overcommit' do
context 'when template directory points to the Overcommit template directory' do
around do |example|
repo(template_dir: Overcommit::Installer::TEMPLATE_DIRECTORY) do
example.run
end
end
it 'automatically installs Overcommit hooks for new repositories' 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|
hook_file = File.join('.git', 'hooks', hook_type)
File.read(hook_file).should include 'OVERCOMMIT'
end
end
context 'and Overcommit is manually installed' do
before do
`overcommit --install`
end
it 'replaces the hooks with symlinks' do
Overcommit::Utils.supported_hook_types.each do |hook_type|
hook_file = File.join('.git', 'hooks', hook_type)
Overcommit::Utils::FileUtils.symlink?(hook_file).should == true
end
end
end
end
end