diff --git a/lib/serverspec/type/file.rb b/lib/serverspec/type/file.rb index 100ec268..7b6b49d1 100644 --- a/lib/serverspec/type/file.rb +++ b/lib/serverspec/type/file.rb @@ -86,6 +86,10 @@ def immutable? @runner.check_file_is_immutable(@name) end + def exists? + @runner.check_file_exists(@name) + end + def md5sum @runner.get_file_md5sum(@name).stdout.strip end diff --git a/spec/type/base/file_spec.rb b/spec/type/base/file_spec.rb index e017bef1..b41d3cb1 100644 --- a/spec/type/base/file_spec.rb +++ b/spec/type/base/file_spec.rb @@ -22,6 +22,10 @@ it { should be_symlink } end +describe file('/bin/sh') do + it { should exist } +end + describe file('/etc/ssh/sshd_config') do it { should contain 'This is the sshd server system-wide configuration file' } end