Guest User

Untitled

a guest
Jul 26th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. require 'chefspec'
  2.  
  3. module SpecHelper
  4. def global_stubs
  5. # Don't worry about external cookbook dependencies
  6. Chef::Cookbook::Metadata.any_instance.stub(:depends)
  7.  
  8. # Test each recipe in isolation, regardless of includes
  9. @included_recipes = []
  10. Chef::RunContext.any_instance.stub(:loaded_recipe?).and_return(false)
  11. Chef::Recipe.any_instance.stub(:include_recipe) do |i|
  12. Chef::RunContext.any_instance.stub(:loaded_recipe?).with(i).and_return(true)
  13. @included_recipes << i
  14. end
  15. Chef::RunContext.any_instance.stub(:loaded_recipes).and_return(@included_recipes)
  16. end
  17. end
Add Comment
Please, Sign In to add comment