mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
947365719a
Needed a fallback on `ENV["project_root"]` not being defined. Signed-off-by: Ryan Davis <zenspider@chef.io>
24 lines
574 B
Ruby
24 lines
574 B
Ruby
require "minitest/autorun"
|
|
require "open3"
|
|
|
|
TEST_CLI_OPTS = "--chef-license=accept-no-persist".freeze
|
|
|
|
class ArtifactTest < Minitest::Test
|
|
make_my_diffs_pretty!
|
|
|
|
def run_cmd(cmd)
|
|
env = { "PATH" => ENV["PATH"] }
|
|
pwd = ENV["project_root"] || `git rev-parse --show-toplevel`.chomp
|
|
opts = { chdir: pwd }
|
|
|
|
Open3.capture3(env, cmd, opts)
|
|
end
|
|
|
|
def assert_artifact(inspec_command)
|
|
stdout, stderr, status = run_cmd "inspec #{inspec_command} #{TEST_CLI_OPTS}"
|
|
|
|
assert_empty stderr.sub(/#< CLIXML\n/, "")
|
|
assert stdout
|
|
assert status
|
|
end
|
|
end
|