I have a piece of code that looks for a vault and then processes all items in there:
chef_vault(vault).each do |item|
# stuff
end
Now I want to test my recipe with ChefSpec. For this I am using the chef vault fixtures and include them in my tests like
include ChefVault::TestFixtures.rspec_shared_context(true)
While this works great for vault items that are accessed in the recipe through chef_vault_item(vault, item)
it doesn't work for the above approach. Here I get the error:
Chef::Exceptions::InvalidDataBagPath:
Data bag path '/var/folders/9r/x_7wsmr936bbx35fln9m7b300000gn/T/d20190515-71819-a47x1p/data_bags' is invalid
The stack trace points to the line of code where I look for the Vault. How do you you guys write your tests when you need to access the whole vault and not just a specific item?