promote cmp usage as it provides results with octal mode

This commit is contained in:
Alex Pop 2016-08-30 18:23:47 +01:00
parent 4673dfd90f
commit fd676ceb5c
4 changed files with 8 additions and 6 deletions

View file

@ -1308,7 +1308,7 @@ The ``mode`` matcher tests if the mode assigned to the file matches the specifie
.. code-block:: ruby
its('mode') { should eq 0644 }
its('mode') { should cmp '0644' }
mtime
+++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1491,7 +1491,7 @@ The following examples show how to use this InSpec audit resource.
.. code-block:: bash
describe file('/dev') do
its('mode') { should eq 00755 }
its('mode') { should cmp '00755' }
end
**Test the owner of a file**
@ -4331,7 +4331,7 @@ The following examples show how to use this InSpec audit resource.
describe ssh_config do
its('owner') { should eq 'root' }
its('mode') { should eq 644 }
its('mode') { should cmp '0644' }
end
**Test SSH configuration**

View file

@ -38,7 +38,7 @@ The following example shows how you can use pure |ruby| code(variables, loops, c
# check key file owners and permissions
describe file(intern['key']) do
it { should be_owned_by username }
its('mode') { should eq 0600 }
its('mode') { should cmp '0600' }
end
end
end

View file

@ -60,8 +60,8 @@ if os.unix?
# it { should have_mode }
its('mode') { should eq 00765 }
it { should be_mode 00765 }
its('mode') { should cmp 0765 }
its('mode') { should_not cmp 0777 }
its('mode') { should cmp '0765' }
its('mode') { should_not cmp '0777' }
its('suid') { should eq false }
its('sgid') { should eq false }
its('sticky') { should eq false }

View file

@ -68,6 +68,8 @@ end
describe file('/dev') do
its('mode') { should eq 00755 }
its('mode') { should cmp '00755' }
its('mode') { should_not cmp '00777' }
end
describe file('/dev') do