厨师|为目录权限分配编写规范

时间:2017-06-09 18:03:01

标签: ruby chef chefspec

我是Chef和ruby的新手并且正在通过一个培训项目工作,我已经挂了一些可能非常简单的东西,但我已经用尽了谷歌搜索和/或提交的能力。我有以下资源......

directory node['tcbuildagent']['toolsfolderpath'] do
  action :create
  owner 'BUILTIN\\Administrators'
  group 'BUILTIN\\Administrators'
  rights :read_execute, 'Everyone', applies_to_children: true
end

...我的规格看起来像......

  it 'creates creates tools directory' do
    expect(chef_run).to create_directory('c:\fakepathone').with(
      owner: 'BUILTIN\\Administrators',
      group: 'BUILTIN\\Administrators',
      rights: [{ permissions: 'read_execute', principals: 'Everyone', applies_to_children: true }]
    )

...对于我的生活,我无法对权利部分进行测试。我最近的错误是......

  1) tcbuildagent::default creates creates tools directory
     Failure/Error:
       expect(chef_run).to create_directory('c:\fakepathone').with(
         owner: 'BUILTIN\\Administrators',
         group: 'BUILTIN\\Administrators',
         rights: [{ permissions: 'read_execute', principals: 'Everyone', applies_to_children: true }]
       )

       expected "directory[c:\fakepathone]" to have parameters:

         rights [{:permissions=>"read_execute", :principals=>"Everyone", :applies_to_children=>true}], was [{:permissions=>:read_execute, :principals=>"Everyone", :applies_to_children=>true}]
       Diff:
       @@ -1,4 +1,4 @@
       -[{:permissions=>"read_execute",
       +[{:permissions=>:read_execute,
          :principals=>"Everyone",
          :applies_to_children=>true}]
     # ./spec/unit/recipes/default_spec.rb:19:in `block (2 levels) in <top (required)>'

...但我一直看到很多其他错误。

我在这里缺少什么?感谢。

1 个答案:

答案 0 :(得分:0)

您有'read_execute'字符串,它必须是:read_execute(即符号)。

'foo' != :foo: - )