Skip to content

Commit

Permalink
Merge pull request #519 from jhoblitt/feature/file_exists
Browse files Browse the repository at this point in the history
add File#exists?
  • Loading branch information
mizzy committed May 12, 2015
2 parents f826562 + d2b92c9 commit b2ac432
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/serverspec/type/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/type/base/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2ac432

Please sign in to comment.