diff --git a/lib/serverspec/type/file.rb b/lib/serverspec/type/file.rb index 22ab9f41..30cb26ad 100644 --- a/lib/serverspec/type/file.rb +++ b/lib/serverspec/type/file.rb @@ -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 diff --git a/spec/redhat/file_spec.rb b/spec/redhat/file_spec.rb index f7dfd55f..657491da 100644 --- a/spec/redhat/file_spec.rb +++ b/spec/redhat/file_spec.rb @@ -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' ) }