2019-06-11 22:24:35 +00:00
|
|
|
require "functional/helper"
|
|
|
|
require "inspec/runner"
|
|
|
|
require "inspec/resources/file"
|
2018-02-26 21:50:51 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "inspec report tests" do
|
2018-02-26 21:50:51 +00:00
|
|
|
include FunctionalHelper
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "report" do
|
|
|
|
it "loads a json report" do
|
|
|
|
o = { "reporter" => ["json"], "report" => true }
|
2018-02-26 21:50:51 +00:00
|
|
|
runner = ::Inspec::Runner.new(o)
|
|
|
|
runner.add_target(example_profile)
|
|
|
|
runner.run
|
2019-09-30 22:31:55 +00:00
|
|
|
_(runner.report.count).must_equal 4
|
|
|
|
_(runner.report.inspect).must_include ':title=>"InSpec Example Profile"'
|
|
|
|
_(runner.report.inspect).must_include ':status=>"passed"'
|
2018-02-26 21:50:51 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "loads a json report twice" do
|
2019-04-30 22:35:34 +00:00
|
|
|
skip "this doesn't work yet, but I'd like to poke at it"
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
o = { "reporter" => ["json"], "report" => true }
|
2019-04-30 22:35:34 +00:00
|
|
|
runner = ::Inspec::Runner.new(o)
|
|
|
|
runner.add_target(example_profile)
|
|
|
|
runner.run
|
2019-09-30 22:31:55 +00:00
|
|
|
_(runner.report.count).must_equal 4
|
|
|
|
_(runner.report.inspect).must_include ':title=>"InSpec Example Profile"'
|
|
|
|
_(runner.report.inspect).must_include ':status=>"passed"'
|
2019-04-30 22:35:34 +00:00
|
|
|
end
|
|
|
|
|
2018-02-26 21:50:51 +00:00
|
|
|
# Due to the way we require/use rspec, you can only run one runner.
|
|
|
|
# You have to reload rspec to run another.
|
|
|
|
end
|
|
|
|
end
|