mishka
mishka

Reputation: 2057

How to load attributes from a file to chefspec node

I have the following layout:

attributes/default.rb
recipes/my_recipe.rb
spec/unit/recipes/my_recipe_spec.rb

In the attributes files I have a lot of common settings likes

default['framework']['folder']['lib'] = '/usr/lib/fwrk'

I would like to use them in my chefspec, like

it 'install the lib if there are changes' do
    lib_path = chef_run.node['framework']['folder']['lib']
    puts(lib_path)
end

How can I include this file to my node from SoloRunner/ServerRunner?

Upvotes: 0

Views: 464

Answers (1)

coderanger
coderanger

Reputation: 54267

Run the .converge() first and you'll see them in there. But remember that you almost ever parameterize your tests on the same inputs on both sides, that wouldn't be a useful test since it doesn't check if the value is what you expected it to be.

Upvotes: 1

Related Questions