docs/resources/registry_key.md.erb in inspec-1.40.0 vs docs/resources/registry_key.md.erb in inspec-1.41.0
- old
+ new
@@ -4,10 +4,12 @@
# registry_key
Use the `registry_key` InSpec audit resource to test key values in the Windows registry.
+<br>
+
## Syntax
A `registry_key` resource block declares the item in the Windows registry, the path to a setting under that item, and then one (or more) name/value pairs to be tested.
Use a registry key name and path:
@@ -59,18 +61,39 @@
# You should use:
describe registry_key('HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1033') do
its('Release') { should eq 378675 }
end
-## Matchers
+<br>
-This InSpec audit resource has the following matchers:
+## Examples
-### be
+The following examples show how to use this InSpec audit resource.
-<%= partial "/shared/matcher_be" %>
+### Test the start time for the Schedule service
+ describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\...\Schedule') do
+ its('Start') { should eq 2 }
+ end
+
+where `'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule'` is the full path to the setting.
+
+### Use a regular expression in responses
+
+ describe registry_key({
+ hive: 'HKEY_LOCAL_MACHINE',
+ key: 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
+ }) do
+ its('ProductName') { should match /^[a-zA-Z0-9\(\)\s]*2012\s[rR]2[a-zA-Z0-9\(\)\s]*$/ }
+ end
+
+<br>
+
+## Matchers
+
+This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
+
### children
The `children` matcher return all of the child items of a registry key. A regular expression may be used to filter child items:
describe registry_key('Key Name', '\path\to\key').children(regex)
@@ -91,18 +114,10 @@
describe registry_key(key) do
its('AlwaysInstallElevated') { should eq 'value' }
end
}
-### cmp
-
-<%= partial "/shared/matcher_cmp" %>
-
-### eq
-
-<%= partial "/shared/matcher_eq" %>
-
### exist
The `exist` matcher tests if the registry key is present:
it { should exist }
@@ -123,18 +138,10 @@
The `have_value` matcher tests if a value exists for a registry key:
it { should have_value 'value' }
-### include
-
-<%= partial "/shared/matcher_include" %>
-
-### match
-
-<%= partial "/shared/matcher_match" %>
-
### name
The `name` matcher tests the value for the specified registry setting:
its('name') { should eq 'value' }
@@ -146,27 +153,5 @@
# instead of:
# its('explorer.exe') { should eq 'test' }
# use the following solution:
it { should have_property_value('explorer.exe', :string, 'test') }
-
-
-## Examples
-
-The following examples show how to use this InSpec audit resource.
-
-### Test the start time for the Schedule service
-
- describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\...\Schedule') do
- its('Start') { should eq 2 }
- end
-
-where `'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule'` is the full path to the setting.
-
-### Use a regular expression in responses
-
- describe registry_key({
- hive: 'HKEY_LOCAL_MACHINE',
- key: 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
- }) do
- its('ProductName') { should match /^[a-zA-Z0-9\(\)\s]*2012\s[rR]2[a-zA-Z0-9\(\)\s]*$/ }
- end