From d2b92c9fe3e68928cb9cfb42cfd807c0f72eb9aa Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Mon, 11 May 2015 22:14:01 -0700 Subject: [PATCH] add File#exists? --- lib/serverspec/type/file.rb | 4 ++++ spec/type/base/file_spec.rb | 4 ++++ 2 files changed, 8 insertions(+) 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