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