mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
Add functional tests for resource_id
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
edf019b0df
commit
fb25c547d0
4 changed files with 31 additions and 0 deletions
5
test/fixtures/profiles/resource_ids/controls/basic.rb
vendored
Normal file
5
test/fixtures/profiles/resource_ids/controls/basic.rb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
control "basic custom resource" do
|
||||
describe basic do
|
||||
its("resource_id") { should cmp "42" }
|
||||
end
|
||||
end
|
10
test/fixtures/profiles/resource_ids/inspec.yml
vendored
Normal file
10
test/fixtures/profiles/resource_ids/inspec.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: resource_ids
|
||||
title: InSpec Profile
|
||||
maintainer: The Authors
|
||||
copyright: The Authors
|
||||
copyright_email: you@example.com
|
||||
license: Apache-2.0
|
||||
summary: An InSpec Compliance Profile
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
7
test/fixtures/profiles/resource_ids/libraries/basic_resource.rb
vendored
Normal file
7
test/fixtures/profiles/resource_ids/libraries/basic_resource.rb
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Basic < Inspec.resource(1)
|
||||
name 'basic'
|
||||
|
||||
def resource_id
|
||||
super("42")
|
||||
end
|
||||
end
|
|
@ -1299,4 +1299,13 @@ EOT
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
describe "when evalutating profiles that reference resource_id" do
|
||||
let(:run_result) { run_inspec_process("exec #{profile}", json: true) }
|
||||
let(:profile) { "#{profile_path}/resource_ids" } # A profile with custom resources and test controls that exercise resource ids
|
||||
it "should evaluate all test controls correctly" do
|
||||
_(run_result.stderr).must_be_empty
|
||||
assert_json_controls_passing
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue