Renamed the matcher to be_inherited.

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
Vasu1105 2022-01-10 12:09:59 +05:30
parent 084bf70392
commit bc9cdc1219
3 changed files with 7 additions and 7 deletions

View file

@ -163,11 +163,11 @@ The `name` matcher tests the value for the specified registry setting:
its('name') { should eq 'value' }
### be_inherit
### be_inherited
The `be_inherit` matcher returns the `Boolean`. It will return `true` if registry key has inheritance enabled.
The `be_inherited` matcher returns the `Boolean`. It will return `true` if registry key has inheritance enabled.
it { should be_inherit }
it { should be_inherited }
**Warning**: Any name with a dot will not work as expected: <code>its('explorer.exe') { should eq 'test' }</code>. For details, see <a href="https://github.com/inspec/inspec/issues/1281">https://github.com/inspec/inspec/issues/1281</a>

View file

@ -113,7 +113,7 @@ module Inspec::Resources
end
# returns true if inheritance is enabled for registry key.
def inherit?
def inherited?
return false unless exists?
cmd = inspec.command("(Get-Acl -Path 'Registry::#{@options[:path]}').access| Where-Object {$_.IsInherited -eq $true} | measure | % { $_.Count }")

View file

@ -36,7 +36,7 @@ describe "Inspec::Resources::RegistryKey" do
_(resource.send(:generate_registry_key_path_from_options)).must_equal 'my_hive\\key_with_no_slash'
end
it "returns inherit and user permissions values" do
it "returns user permissions values" do
resource = MockLoader.new(:windows).load_resource("registry_key", 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule')
resource.stubs(:exist?).returns(true)
resource.stubs(:user_permissions).returns({ "NT AUTHORITY\\SYSTEM" => "FullControl", "NT AUTHORITY\\Authenticated Users" => "ReadAndExecute", "BUILTIN\\Administrators" => "FullControl" })
@ -46,7 +46,7 @@ describe "Inspec::Resources::RegistryKey" do
it "returns true if file has inherit enabled on Windows." do
resource = MockLoader.new(:windows).load_resource("registry_key", 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule')
resource.stubs(:exist?).returns(true)
resource.stubs(:inherit?).returns(true)
_(resource.inherit?).must_equal true
resource.stubs(:inherited?).returns(true)
_(resource.inherited?).must_equal true
end
end