summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2016-11-16 23:15:19 +0200
committerSean McGivern <sean@gitlab.com>2016-12-01 11:41:03 +0000
commit5043d13bac184ed1092a67afb33a1b108c5e03d6 (patch)
tree86a4afac30541a09ed26746d35020df289abd3de
parent17691041ae723145f78a081a16809d0afb8136f1 (diff)
downloadgitlab-shell-5043d13bac184ed1092a67afb33a1b108c5e03d6.tar.gz
cleanup dirs in before to fixup aborted tests
-rw-r--r--spec/gitlab_custom_hook_spec.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/gitlab_custom_hook_spec.rb b/spec/gitlab_custom_hook_spec.rb
index 69809b9..f6b16bb 100644
--- a/spec/gitlab_custom_hook_spec.rb
+++ b/spec/gitlab_custom_hook_spec.rb
@@ -45,6 +45,13 @@ describe GitlabCustomHook do
create_hook(path, 'custom_hooks/post-receive.d/hook', which)
end
+ def cleanup_hook_setup
+ FileUtils.rm_rf(File.join(tmp_repo_path, 'custom_hooks'))
+ FileUtils.rm_rf(File.join(tmp_repo_path, 'hooks'))
+ FileUtils.rm_rf(File.join(tmp_repo_path, 'hooks.d'))
+ FileUtils.rm_rf(File.join(tmp_root_path, 'hooks'))
+ end
+
# setup paths
# <repository>.git/hooks/ - symlink to gitlab-shell/hooks global dir
# <repository>.git/hooks/<hook_name> - executed by git itself, this is gitlab-shell/hooks/<hook_name>
@@ -56,6 +63,8 @@ describe GitlabCustomHook do
# as global scripts are ran first, failing global skips repo hooks
before do
+ cleanup_hook_setup
+
FileUtils.mkdir_p(File.join(tmp_root_path, 'hooks'))
FileUtils.mkdir_p(File.join(tmp_root_path, 'hooks', 'update.d'))
FileUtils.mkdir_p(File.join(tmp_root_path, 'hooks', 'pre-receive.d'))
@@ -69,10 +78,7 @@ describe GitlabCustomHook do
end
after do
- FileUtils.rm_rf(File.join(tmp_repo_path, 'custom_hooks'))
- FileUtils.rm_rf(File.join(tmp_repo_path, 'hooks'))
- FileUtils.rm_rf(File.join(tmp_repo_path, 'hooks.d'))
- FileUtils.rm_rf(File.join(tmp_root_path, 'hooks'))
+ cleanup_hook_setup
end
context 'with gl_id_test_hook' do