Skip to content

Instantly share code, notes, and snippets.

@hartmantis
hartmantis / spec_helper.rb
Last active November 15, 2017 15:50
ChefSpec stubs for testing a recipe in isolation
require 'chefspec'
module SpecHelper
def global_stubs
# Don't worry about external cookbook dependencies
Chef::Cookbook::Metadata.any_instance.stub(:depends)
# Test each recipe in isolation, regardless of includes
@included_recipes = []
Chef::RunContext.any_instance.stub(:loaded_recipe?).and_return(false)