diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-06-08 12:16:35 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-06-08 12:16:35 +0000 |
| commit | 5eef2e4c1a5c28f4e2b8e48e4701dae56264a979 (patch) | |
| tree | f853dc1c8601fb4222908f2ce8d4e03880367db3 /spec/support | |
| parent | 12ef778891c4bf9fae19ffdc9d566fc7ab309957 (diff) | |
| parent | 55d3e5288826e21286054ed7cbaaec15e037f1dd (diff) | |
Merge branch 'asdf-java-version' into 'master'v3.11.2
Load the configured version of Java/Python
See merge request gitlab-org/security-products/license-management!163
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/integration_test_helper.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb index aa3f0c0..f474265 100644 --- a/spec/support/integration_test_helper.rb +++ b/spec/support/integration_test_helper.rb @@ -40,13 +40,13 @@ module IntegrationTestHelper class IntegrationTestRunner attr_reader :project_path - def initialize(project_path = File.join(Dir.pwd, 'tmp', SecureRandom.uuid)) + def initialize(project_path = Pathname.pwd.join('tmp').join(SecureRandom.uuid)) FileUtils.mkdir_p(project_path) - @project_path = project_path + @project_path = Pathname(project_path) end def add_file(name, content = nil) - full_path = Pathname.new(File.join(project_path, name)) + full_path = project_path.join(name) FileUtils.mkdir_p(full_path.dirname) IO.write(full_path, block_given? ? yield : content) end @@ -57,22 +57,22 @@ module IntegrationTestHelper def clone(repo, branch: 'master') if branch.match?(/\b[0-9a-f]{5,40}\b/) - execute({}, 'git', 'clone', '--quiet', repo, project_path) + execute({}, 'git', 'clone', '--quiet', repo, project_path.to_s) Dir.chdir project_path do execute({}, 'git', 'checkout', branch) end else - execute({}, 'git', 'clone', '--quiet', '--depth=1', '--single-branch', '--branch', branch, repo, project_path) + execute({}, 'git', 'clone', '--quiet', '--depth=1', '--single-branch', '--branch', branch, repo, project_path.to_s) end end def scan(env: {}) - return {} unless execute(env, './bin/docker-test', project_path) + return {} unless execute(env, './bin/docker-test', project_path.to_s) - report_path = "#{project_path}/gl-license-management-report.json" - return {} unless File.exist?(report_path) + report_path = project_path.join('gl-license-management-report.json') + return {} unless report_path.exist? - Report.new(IO.read(report_path)) + Report.new(report_path.read) end def execute(env = {}, *args) @@ -82,7 +82,7 @@ module IntegrationTestHelper end def cleanup - FileUtils.rm_rf(project_path) if Dir.exist?(project_path) + FileUtils.rm_rf(project_path) if project_path.exist? end end |
