Skip to content

Commit

Permalink
Merge pull request #439 from jonnangle/add_be_immutable
Browse files Browse the repository at this point in the history
Add be_immutable matcher on file type
  • Loading branch information
mizzy committed Jul 9, 2014
2 parents 3d1be61 + 00ce95e commit d52c552
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 @@ -73,6 +73,10 @@ def mounted?(attr, only_with)
backend.check_mounted(@name, attr, only_with)
end

def immutable?
backend.check_immutable(@name)
end

def match_checksum(checksum)
backend.check_file_checksum(@name, checksum)
end
Expand Down
5 changes: 5 additions & 0 deletions spec/redhat/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@
it { should_not be_mounted }
end

describe file('/etc/immutable-file') do
it { should be_immutable }
its(:command) { should eq "lsattr -d /etc/immutable-file 2>&1 | awk '$1~/^-*i-*$/ {exit 0} {exit 1}'" }
end

describe file('/') do
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
it { should be_mounted.with( :type => 'ext4' ) }
Expand Down

0 comments on commit d52c552

Please sign in to comment.