serverspec资源类型指南没有解释如何测试文件的缺失,而不是它的存在。这是我能想到的最好的:
describe command('/bin/bash -c "[[ ! -e /var/foo ]]"') do
its(:exit_status) { should eq 0 }
end这看起来非常笨重,但比利用内置的更好:
describe file('/var/foo') do
it { should_not be_file }
it { should_not be_directory }
it { should_not be_socket }
it { should_not be_symlink }
end有更好的方法吗?
发布于 2015-04-16 19:23:26
serverspec File对象现在响应.exists?,因此这是可行的:
describe file('/var/foo') do
it { should_not exist }
endserverspec v2.17.0中的特性加进。
https://serverfault.com/questions/682671
复制相似问题