summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-23 15:36:17 -0600
committermo khan <mo.khan@gmail.com>2020-04-03 16:28:53 -0600
commit93f7c568e1104936de011626d3bd7f56ebe66355 (patch)
treead7b589d18aec83d4f09d0e64b75e1581c85589b /spec/support
parent93a00df11d79c9f59141ff42ce05ab3b3d329375 (diff)
Install root certificate
* Install certificate in root ca trust store * Use PIP_CERT environment variable to specify path to the certificate bundle * Do not override user provided PIP_CERT * Perform shallow clone when possible * Update CHANGELOG and bump version
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/fixture_file_helper.rb9
-rw-r--r--spec/support/integration_test_helper.rb17
2 files changed, 21 insertions, 5 deletions
diff --git a/spec/support/fixture_file_helper.rb b/spec/support/fixture_file_helper.rb
index fe11acd..5a9599f 100644
--- a/spec/support/fixture_file_helper.rb
+++ b/spec/support/fixture_file_helper.rb
@@ -1,6 +1,11 @@
module FixtureFileHelper
- def fixture_file_content(path)
- IO.read(fixture_file(path))
+ def fixture_file_content(path, data = {})
+ content = IO.read(fixture_file(path))
+ return content unless path.end_with?('.erb')
+
+ ERB
+ .new(content)
+ .result(OpenStruct.new(data).send(:binding))
end
def fixture_file(path)
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