mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
handle nil properties in iis_site (#3040)
* return nil instead of trying to index into nil * fix typo * add spec for deleted site Signed-off-by: Tor Magnus Rakvåg <tm@intility.no>
This commit is contained in:
parent
1046a77027
commit
367f91ea31
2 changed files with 14 additions and 5 deletions
|
@ -40,19 +40,19 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def app_pool
|
||||
iis_site[:app_pool]
|
||||
iis_site.nil? ? nil : iis_site[:app_pool]
|
||||
end
|
||||
|
||||
def bindings
|
||||
iis_site[:bindings]
|
||||
iis_site.nil? ? nil : iis_site[:bindings]
|
||||
end
|
||||
|
||||
def state
|
||||
iis_site[:state]
|
||||
iis_site.nil? ? nil : iis_site[:state]
|
||||
end
|
||||
|
||||
def path
|
||||
iis_site[:path]
|
||||
iis_site.nil? ? nil : iis_site[:path]
|
||||
end
|
||||
|
||||
def exists?
|
||||
|
|
|
@ -33,10 +33,19 @@ describe iis_website('Default Web Site') do
|
|||
end
|
||||
|
||||
describe iis_app('/TestApp', 'Default Web Site') do
|
||||
it { sould exist }
|
||||
it { should exist }
|
||||
it { should have_application_pool('DefaultAppPool') }
|
||||
it { should have_protocols('http') }
|
||||
it { should have_site_name('Default Web Site') }
|
||||
it { should have_physical_path('C:\\inetpub\\wwwroot\\Test') }
|
||||
it { should have_path('\\TestApp') }
|
||||
end
|
||||
|
||||
# test testing a non existing website
|
||||
describe iis_site('DeletedSite') do
|
||||
it { should_not exist }
|
||||
its('app_pool') { should eq nil }
|
||||
its('bindings') { should eq nil }
|
||||
its('state') { should eq nil }
|
||||
its('path') { should eq nil }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue