Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 如何将属性从文件加载到chefspec节点_Ruby_Rspec_Chef Infra_Chefspec - Fatal编程技术网

Ruby 如何将属性从文件加载到chefspec节点

Ruby 如何将属性从文件加载到chefspec节点,ruby,rspec,chef-infra,chefspec,Ruby,Rspec,Chef Infra,Chefspec,我的布局如下: attributes/default.rb recipes/my_recipe.rb spec/unit/recipes/my_recipe_spec.rb 在属性文件中,我有很多常见的设置,比如 default['framework']['folder']['lib'] = '/usr/lib/fwrk' 我想在我的chefspec中使用它们,比如 it 'install the lib if there are changes' do lib_path = che

我的布局如下:

attributes/default.rb
recipes/my_recipe.rb
spec/unit/recipes/my_recipe_spec.rb
在属性文件中,我有很多常见的设置,比如

default['framework']['folder']['lib'] = '/usr/lib/fwrk'
我想在我的chefspec中使用它们,比如

it 'install the lib if there are changes' do
    lib_path = chef_run.node['framework']['folder']['lib']
    puts(lib_path)
end
如何从SolorRunner/ServerRunner将此文件包含到节点中

首先运行.converge,您将在那里看到它们。但是请记住,您几乎曾经在两侧的相同输入上参数化测试,这不是一个有用的测试,因为它不会检查值是否与您期望的值相同。

是的,我忘记了在访问节点之前运行converge