From a35a22ae051d9b1ab97eb91ea4354baba2addf80 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 31 Jul 2014 21:01:42 +0300
Subject: [PATCH] Remove test dir only if exists

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 spec/support/test_env.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 9e8339ff71..1f930eac02 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -15,8 +15,12 @@ module TestEnv
 
     # Clean /tmp/tests
     tmp_test_path = Rails.root.join('tmp', 'tests')
-    FileUtils.rm_r(tmp_test_path)
-    FileUtils.mkdir(tmp_test_path)
+
+    if File.directory?(tmp_test_path)
+      FileUtils.rm_r(tmp_test_path)
+    end
+
+    FileUtils.mkdir_p(tmp_test_path)
 
     # Setup GitLab shell for test instance
     setup_gitlab_shell
-- 
2.30.9