Question

I have a recipe that depends on the apache2 cookbook to, among other things, enable a module using the definition:

apache_module 'passenger'

Is there a way to test that call with chefspec ?

According to "Chef libraries or definitions?", a definition is just a grouping of several resources.

Should I add expectations for each resource added by the definition ?
Or is that testing 3rd party code ?

Was it helpful?

Solution

You cannot test definition calls with ChefSpec. As definitions do not actually exist in the resource collection, you can't assert they have been called. You could assert than an object contained in the definition is called.

Sources:

  • I wrote it
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top