summaryrefslogtreecommitdiff
path: root/spec/support/integration_test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/integration_test_helper.rb')
-rw-r--r--spec/support/integration_test_helper.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb
index bcc5c1f..6c30a99 100644
--- a/spec/support/integration_test_helper.rb
+++ b/spec/support/integration_test_helper.rb
@@ -56,9 +56,13 @@ module IntegrationTestHelper
end
def clone(repo, branch: 'master')
- execute({}, "git", "clone", '--quiet', repo, project_path)
- Dir.chdir project_path do
- execute({}, "git", "checkout", branch)
+ if branch.match?(/\b[0-9a-f]{5,40}\b/)
+ execute({}, 'git', 'clone', '--quiet', repo, project_path)
+ Dir.chdir project_path do
+ execute({}, 'git', 'checkout', branch)
+ end
+ else
+ execute({}, 'git', 'clone', '--quiet', '--depth=1', '--single-branch', '--branch', branch, repo, project_path)
end
end
@@ -85,4 +89,11 @@ module IntegrationTestHelper
def runner(*args)
@runner ||= IntegrationTestRunner.new(*args)
end
+
+ def add_host(name, ip)
+ return unless ENV['LM_HOME']
+ return if system("grep #{name} /etc/hosts")
+
+ system("echo '#{ip} #{name}' >> /etc/hosts")
+ end
end