[chef] Re: Can I expose a ChefSpec stub to all cookbooks' tests?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Can I expose a ChefSpec stub to all cookbooks' tests?
  • Date: Thu, 18 Sep 2014 10:13:07 -0700

morning,
you can move the stubs in a helper module. and include that module via rspec's configuration in your spec_helper. You can then choose to invoke them before all or case by case basis,

e.g

happy testing,

ranjib

p.s. you can raise these questions in chef-testing mailing list or chefspec github repo as well :-)



On Thu, Sep 18, 2014 at 7:57 AM, spiffytech < " target="_blank"> > wrote:
I have cookbooks that run shell commands (via `execute` or `not_if` blocks), which ChefSpec predictably complains need to be stubbed. These cookbooks are included in many places, and I wind up copy/pasting a stub into a `before` block in the tests of many other cookbooks that include the offending cookbook even as a dependency of a dependency of a dependency.

Can I somehow stub these shell commands right in the cookbook that issues them, such that ChefSpec tests for any other cookbook will pick up the stubs?




Archive powered by MHonArc 2.6.16.

§