chef / chef-vault-testfixtures

provides an RSpec shared context for testing Chef cookbooks that use chef-vault
Apache License 2.0
7 stars 10 forks source link

Don't stub Chef::DataBagItem.load by default #12

Closed jf647 closed 9 years ago

jf647 commented 9 years ago

This fixes issue #11 and ensures that you can still stub an unencrypted data bag.

mhenrixon commented 9 years ago

Even with this I can't make it work... get errors like

10) db-server::user
     Failure/Error: cached(:chef_run) { converge }
       Double "vault item db_users/casinosaga" received :[] with unexpected arguments
         expected: ("password")
              got: ("id")
        Please stub a default value first if message might be received with other args as well.
jf647 commented 9 years ago

Can you share the recipe that is driving this? We don't stub the 'id' key of the vault item, and I've not run into a recipe that needed it before. It's a simple enough stub to add, but I'd like to understand the use case better before blindly adding it.

mhenrixon commented 9 years ago

I use it all over the place. Why would you skip the id? Doesn't make sense. Just stub everything in the json. I can't think of a single reason why not

mhenrixon commented 9 years ago

On second glance it looks like a little something was missing. I added the following to my stubs:

allow(ChefVault::Item).to receive(:load).and_call_original

That seems to do the trick for me.