diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-05 14:06:35 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-05 14:06:35 -0600 |
| commit | 8371eb864228b281a9b52b3a41bd5d5bdc8c0049 (patch) | |
| tree | c0818e18c44743d0afef8f6fdacccd1e05f47eca | |
| parent | 812d23695017ae34f196d19742821f20167c3704 (diff) | |
Update usages of pathname
| -rw-r--r-- | spec/support/integration_test_helper.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb index e84ddd0..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 = 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.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 |
