Skip to content

Instantly share code, notes, and snippets.

View Zhengquan's full-sized avatar

Zhengquan Zhengquan

  • ThoughtWorks
  • Beijing
View GitHub Profile
@Zhengquan
Zhengquan / spec_helper.rb
Last active July 27, 2016 05:53 — forked from hartmantis/spec_helper.rb
ChefSpec stubs for testing a recipe in isolation with new syntax
module IncludeRecipeHelper
def global_stubs
# Don't worry about external cookbook dependencies
allow_any_instance_of(Chef::Cookbook::Metadata).to receive(:depends)
# Test each recipe in isolation, regardless of includes
@included_recipes = []
allow_any_instance_of(Chef::RunContext).to receive(:loaded_recipe?).and_return(false)