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

Chef | Writting a Spec for Directory Rights assignment

我是 Chef 和 ruby 的新手,正在完成一个培训项目,但我对一些可能非常简单的东西很感兴趣,但我已经用尽了 google 搜索的能力and/or 击败屈服。我有以下资源...

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)>'

...但我在此过程中看到了许多其他错误。

我在这里错过了什么?谢谢

你有 'read_execute' 作为字符串,它需要是 :read_execute(即一个符号)。

'foo' != :foo:-)