I have looked through the issues but I don't see a specific case like mine for stubbing the library I have created and need a little guidance as I have a feeling Chef is coming in to play here by overwriting my rspec stub.
I have a recipe that has a method
databag = encrypted_data_bag_item('id', 'item')
I have library file in another cookbook that defines this method and then in the recipe I do something like this to make it available to recipes:
I would like to mock the call to encrypted_data_bag_item and return a hashed result. I have tried several approaches but none seem to work. I'm getting this failure before the mock as well
Failure/Error: ChefSpec::Runner.new do |node|
Cannot find a resource for encrypted_data_bag_item on chefspec version 0.6.1
Not sure where the version 0.6.1 is coming from as I am using chefspec 3.0.1
Any help would be much appreciated.
Ah, it was the 'any_instance' message I was missing. Thanks again Seth!