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.rb20
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