diff options
author | Rémy Coutable <remy@rymai.me> | 2017-05-10 18:19:48 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-05-18 14:04:50 +0300 |
commit | 628cc84891228895daa19d7b1300fc032cb26910 (patch) | |
tree | 09a4017fb8d14cbbeeaa970357f0d2bb46aea5d6 /spec/support/test_env.rb | |
parent | a67bb1f0ede51acab88dc3a11928a6d07bd189e7 (diff) |
Factorize TestEvent#copy_repo
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support/test_env.rb')
-rw-r--r-- | spec/support/test_env.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 9bf9dc5d4b2..f319c9634e3 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -170,13 +170,13 @@ module TestEnv end end - def copy_repo(project) - base_repo_path = File.expand_path(factory_repo_path_bare) + def copy_repo(project, copy_fork: false) + base_repo_path = File.expand_path(copy_fork ? forked_repo_path_bare : factory_repo_path_bare) target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.full_path}.git") FileUtils.mkdir_p(target_repo_path) FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) FileUtils.chmod_R 0755, target_repo_path - set_repo_refs(target_repo_path, BRANCH_SHA) + set_repo_refs(target_repo_path, copy_fork ? FORKED_BRANCH_SHA : BRANCH_SHA) end def repos_path @@ -191,15 +191,6 @@ module TestEnv Gitlab.config.pages.path end - def copy_forked_repo_with_submodules(project) - base_repo_path = File.expand_path(forked_repo_path_bare) - target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.full_path}.git") - FileUtils.mkdir_p(target_repo_path) - FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) - FileUtils.chmod_R 0755, target_repo_path - set_repo_refs(target_repo_path, FORKED_BRANCH_SHA) - end - # When no cached assets exist, manually hit the root path to create them # # Otherwise they'd be created by the first test, often timing out and |