1

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

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

我在这里想念什么?谢谢。

4

1 回答 1

1

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

'foo' != :foo:-)

于 2017-06-09T19:24:02.883 回答