File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 4
4
subject { shell ( %w[ overcommit --run ] ) }
5
5
6
6
context 'when using an existing pre-commit hook script' do
7
+ if Overcommit ::OS . windows?
8
+ let ( :script_name ) { 'test-script.exe' }
9
+ let ( :script_contents ) { 'exit 0' }
10
+ else
11
+ let ( :script_name ) { 'test-script' }
12
+ let ( :script_contents ) { "#!/bin/bash\n exit 0" }
13
+ end
14
+
7
15
let ( :config ) do
8
16
{
9
17
'PreCommit' => {
10
18
'MyHook' => {
11
19
'enabled' => true ,
12
- 'required_executable' => './test-script' ,
20
+ 'required_executable' => "./ #{ script_name } " ,
13
21
}
14
22
}
15
23
}
18
26
around do |example |
19
27
repo do
20
28
File . open ( '.overcommit.yml' , 'w' ) { |f | f . puts ( config . to_yaml ) }
21
- echo ( "#!/bin/bash \n exit 0" , 'test-script' )
22
- `git add test-script `
23
- FileUtils . chmod ( 0755 , 'test-script' )
29
+ echo ( script_contents , script_name )
30
+ `git add #{ script_name } `
31
+ FileUtils . chmod ( 0755 , script_name )
24
32
example . run
25
33
end
26
34
end
You can’t perform that action at this time.
0 commit comments