Fix directory resource output and exists check (#1950)

* Fix to_s on directory resource

The `to_s` method on the `directory` resource is not defined
in the correct class, leading `directory` resources to be printed
as the parent resource (`file`) instead.

Signed-off-by: Adam Leff <adam@leff.co>

* Directory existence should check to see if it's a directory

Signed-off-by: Adam Leff <adam@leff.co>
This commit is contained in:
Adam Leff 2017-06-23 10:44:15 -04:00 committed by Christoph Hartmann
parent c808712182
commit b4f772546b

View file

@ -13,9 +13,13 @@ module Inspec::Resources
it { should be_directory }
end
"
end
def to_s
"Directory #{@path}"
def exist?
file.exist? && file.directory?
end
def to_s
"Directory #{source_path}"
end
end
end