我在 serverspec 配方中进行了以下测试 - 哈希只是 Chef 中描述的整个资源(我希望在某个时候通过管道输入)
# Test Folder Permissons
# hash taken from attributes
share = {
"name" => "example",
"sharepath" => "d:/example",
"fullshareaccess" => "everyone",
"ntfsfullcontrol" => "u-dom1/s37374",
"ntfsmodifyaccess" => "",
"ntfsreadaccess" => "everyone"
}
# Explicitly test individual permissions (base on NTFSSecurity module)
describe command ('get-ntfsaccess d:/example -account u-dom1\s37374') do
its(:stdout) { should include "FullControl" }
end
我遇到的问题是将变量放入命令资源中 - 我是 ruby 新手,想知道我是否遗漏了一些东西。
我希望命令资源调用接受变量而不是硬编码。
例如
describe command ('get-ntfsaccess d:/example -account "#{ntfsfullcontrol}"') do
its(:stdout) { should include "FullControl" }
end
我已经设法在:stdout
测试中使用变量,但无法让它们在命令行中工作。
非常感谢任何帮助