2016-09-01 12:25:56 +00:00
|
|
|
# copyright: 2015, Chef Software, Inc.
|
|
|
|
|
2019-11-06 22:40:00 +00:00
|
|
|
title 'failures / profile'
|
2016-09-01 12:25:56 +00:00
|
|
|
|
2016-09-01 22:54:03 +00:00
|
|
|
# control, first test passes, second fails
|
|
|
|
control "tmp-1.0" do # A unique ID for this control
|
|
|
|
impact 0.7 # The criticality, if this control fails.
|
2019-11-06 22:40:00 +00:00
|
|
|
title "Create / directory" # A human-readable title
|
2016-09-01 22:54:03 +00:00
|
|
|
desc "An optional description..." # Describe why this is needed
|
|
|
|
tag data: "temp data" # A tag allows you to associate key information
|
|
|
|
tag "security" # to the test
|
|
|
|
ref "Document A-12", url: 'http://...' # Additional references
|
|
|
|
|
2019-11-06 22:40:00 +00:00
|
|
|
describe file('/') do # The actual test
|
2016-09-01 22:54:03 +00:00
|
|
|
it { should be_directory }
|
|
|
|
it { should_not be_directory }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# anonymous describe block, first passes, second is syntax error
|
2019-11-06 22:40:00 +00:00
|
|
|
describe file('/') do
|
2016-09-01 12:25:56 +00:00
|
|
|
it { should be_directory }
|
|
|
|
it { should_nota be_directory }
|
|
|
|
end
|
2016-09-01 22:54:03 +00:00
|
|
|
|
|
|
|
# anonymous describe block, first fails, second passes
|
2019-11-06 22:40:00 +00:00
|
|
|
describe file('/') do
|
2016-09-01 22:54:03 +00:00
|
|
|
it { should_not be_directory }
|
|
|
|
it { should be_directory }
|
2016-10-11 10:00:24 +00:00
|
|
|
its('mode') { should cmp '01147' }
|
2016-09-01 22:54:03 +00:00
|
|
|
end
|
2016-10-05 18:01:24 +00:00
|
|
|
|
|
|
|
# control, first and second fail, third passes
|
|
|
|
control 'cmp-1.0' do
|
|
|
|
title 'Using the cmp matcher for numbers'
|
|
|
|
describe 7 do
|
|
|
|
it { should cmp >= 9 }
|
|
|
|
it { should_not cmp /^\d$/ }
|
|
|
|
it { should cmp == '7' }
|
|
|
|
end
|
|
|
|
end
|