2019-09-18 23:52:34 +00:00
|
|
|
require "minitest/autorun"
|
|
|
|
|
|
|
|
class TestArtifactDetect < Minitest::Test
|
2019-11-06 22:31:47 +00:00
|
|
|
def test_inspec_exists_linux
|
|
|
|
skip if windows?
|
|
|
|
refute_match(/no inspec/, `/usr/bin/which inspec`)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_inspec_exists_windows
|
|
|
|
skip unless windows?
|
|
|
|
assert_match(/inspec.bat/, `Get-Command inspec`)
|
|
|
|
end
|
|
|
|
|
2019-09-18 23:52:34 +00:00
|
|
|
def test_detect
|
2019-11-06 22:31:47 +00:00
|
|
|
exit = nil
|
2019-10-17 03:38:37 +00:00
|
|
|
out, err = capture_subprocess_io do
|
2019-11-06 22:31:47 +00:00
|
|
|
exit = system("inspec detect --no-color")
|
2019-10-17 03:38:37 +00:00
|
|
|
end
|
2019-09-18 23:52:34 +00:00
|
|
|
|
2019-11-06 22:31:47 +00:00
|
|
|
assert_empty err.sub(/#< CLIXML\n/, "")
|
|
|
|
assert_match(/Platform Details/, out)
|
|
|
|
assert exit
|
2019-09-19 01:19:51 +00:00
|
|
|
end
|
2019-09-18 23:52:34 +00:00
|
|
|
end
|