mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Move exist checks to own test. Use open3
Signed-off-by: Miah Johnson <miah@chia-pet.org>
This commit is contained in:
parent
13a1c30ba6
commit
6ad21441e4
1 changed files with 9 additions and 18 deletions
|
@ -1,24 +1,15 @@
|
|||
require "minitest/autorun"
|
||||
require_relative "artifact_helper"
|
||||
require "open3"
|
||||
|
||||
class TestArtifactDetect < Minitest::Test
|
||||
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
|
||||
class TestInspecDetect < Minitest::Test
|
||||
parallelize_me!
|
||||
|
||||
def test_detect
|
||||
exit = nil
|
||||
out, err = capture_subprocess_io do
|
||||
exit = system("inspec detect --no-color")
|
||||
end
|
||||
command = "/bin/inspec detect --no-color #{TEST_CLI_OPTS}"
|
||||
stdout, stderr, status = Open3.capture3(command)
|
||||
|
||||
assert_empty err.sub(/#< CLIXML\n/, "")
|
||||
assert_match(/Platform Details/, out)
|
||||
assert exit
|
||||
assert_empty stderr.sub(/#< CLIXML\n/, "")
|
||||
assert_match(/Platform Details/, stdout)
|
||||
assert status
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue