summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 00:24:03 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 00:24:03 -0800
commit0b8e41aae2d6d64d18d8034e863e72cc832d0b83 (patch)
tree73521e7658c81908dc2a47be207fae05eadec2d1
parent0e9f4320b59e8a13008f8b1b1b241af87c053619 (diff)
parent82536f50a20fc89812e9b8b291788347ca53d332 (diff)
downloadgitlab-ce-0b8e41aae2d6d64d18d8034e863e72cc832d0b83.tar.gz
Merge branch 'master' of github.com:gitlabhq/gitlabhq
-rw-r--r--spec/support/test_env.rb34
1 files changed, 20 insertions, 14 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 1c150cbfe25..f869488d8d8 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -22,16 +22,7 @@ module TestEnv
# Disable mailer for spinach tests
disable_mailer if opts[:mailer] == false
- # Clean /tmp/tests
- tmp_test_path = Rails.root.join('tmp', 'tests')
-
- if File.directory?(tmp_test_path)
- Dir.entries(tmp_test_path).each do |entry|
- unless ['.', '..', 'gitlab-shell', factory_repo_name].include?(entry)
- FileUtils.rm_r(File.join(tmp_test_path, entry))
- end
- end
- end
+ clean_test_path
FileUtils.mkdir_p(repos_path)
@@ -50,15 +41,30 @@ module TestEnv
allow_any_instance_of(NotificationService).to receive(:mailer).and_call_original
end
+ # Clean /tmp/tests
+ #
+ # Keeps gitlab-shell and gitlab-test
+ def clean_test_path
+ tmp_test_path = Rails.root.join('tmp', 'tests', '**')
+
+ Dir[tmp_test_path].each do |entry|
+ unless File.basename(entry) =~ /\Agitlab-(shell|test)\z/
+ FileUtils.rm_rf(entry)
+ end
+ end
+ end
+
def setup_gitlab_shell
- `rake gitlab:shell:install`
+ unless File.directory?(Rails.root.join(*%w(tmp tests gitlab-shell)))
+ `rake gitlab:shell:install`
+ end
end
def setup_factory_repo
clone_url = "https://gitlab.com/gitlab-org/#{factory_repo_name}.git"
unless File.directory?(factory_repo_path)
- system(*%W(git clone #{clone_url} #{factory_repo_path}))
+ system(*%W(git clone -q #{clone_url} #{factory_repo_path}))
end
Dir.chdir(factory_repo_path) do
@@ -79,7 +85,7 @@ module TestEnv
end
# We must copy bare repositories because we will push to them.
- system(*%W(git clone --bare #{factory_repo_path} #{factory_repo_path_bare}))
+ system(*%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
end
def copy_repo(project)
@@ -101,7 +107,7 @@ module TestEnv
end
def factory_repo_path_bare
- factory_repo_path.to_s + '_bare'
+ "#{factory_repo_path}_bare"
end
def factory_repo_name