0

I have a Chef cookbook (cookbook_alpha::default) that includes another cookbook (cookbook_bravo::default) using include_recipe 'cookbook_bravo::default'.

When I'm testing cookbook_alpha using ChefSpec, all of the resources in cookbook_alpha are shown and are tested. But the resources (files, templates, users etc) in cookbook_bravo show up as Untouched resources in cookbook_alpha test run. cookbook_bravo has it's own test suites and is covered adequately and I see no need to write duplicate, additional specs in cookbook_alpha simply to cover the resources from cookbook_bravo that are already tested.

Jacques Betancourt
  • 2,652
  • 3
  • 18
  • 19
  • See [here](https://github.com/sethvargo/chefspec#reporting) about the filters to avoid this behavior. – Tensibai Jul 02 '15 at 08:39

1 Answers1

0

Depending on your cookbook dependency manager (Berkshelf, Librarian, none) ChefSpec can determine, if a chef resource call is made outside or inside the current cookbook. (You still may have to stub calls to data bags and thinngs like file system checks in pre-conditionals (only_if, not_if)).

If you, for whatevery reasons, can't use any of the integration, you still can stub the include_recipe call as described in the ReadMe:

https://github.com/sethvargo/chefspec#include_recipe

hope this answers your question.

Roland
  • 1,426
  • 9
  • 9