Skip to content

Commit

Permalink
Merge pull request #547 from twolfson/dev/file.link.target.sqwished
Browse files Browse the repository at this point in the history
Added link_target to file
  • Loading branch information
mizzy committed Dec 24, 2015
2 parents 3c22bc9 + 89916b8 commit 20db239
Show file tree
Hide file tree
Showing 2 changed files with 9 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 @@ -117,6 +117,10 @@ def version?(version)
@runner.check_file_has_version(@name, version)
end

def link_target
@runner.get_file_link_target(@name).stdout.strip
end

def mtime
d = @runner.get_file_mtime(@name).stdout.strip
DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
Expand Down
5 changes: 5 additions & 0 deletions spec/type/base/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@
its(:content) { should match /root:x:0:0/ }
end

describe file('/etc/pam.d/system-auth') do
let(:stdout) { "/etc/pam.dsystem-auth-ac\r\n" }
its(:link_target) { should eq '/etc/pam.dsystem-auth-ac' }
end

describe file('/etc/passwd') do
let(:stdout) { Time.now.to_i.to_s }
its(:mtime) { should > DateTime.now - 1 }
Expand Down

0 comments on commit 20db239

Please sign in to comment.