serverspec guide on resource types没有解释如何测试文件的缺失,而不是它的存在.这是我能想到的最好的:
- describe command('/bin/bash -c "[[ ! -e /var/foo ]]"') do
- its(:exit_status) { should eq 0 }
- end
这似乎非常笨重,但比leveraging the builtins更好:
- 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
有一个更好的方法吗?