Skip to content

Instantly share code, notes, and snippets.

@charlesjohnson
Created April 4, 2013 04:00
Show Gist options
  • Save charlesjohnson/5307717 to your computer and use it in GitHub Desktop.
Save charlesjohnson/5307717 to your computer and use it in GitHub Desktop.
Fix for apache2 cookbook 1.6.0 broken test library ~/.berkshelf/cookbooks/apache2-1.6.0/files/default/tests/minitest/support/helpers.rb Line 50
#def ran_recipe?(recipe)
# node.run_state[:seen_recipes].keys.include?(recipe)
#end
def ran_recipe?(recipe)
if Chef::VERSION < "11.0"
seen_recipes = node.run_state[:seen_recipes]
recipes = seen_recipes.keys.each { |i| i }
else
recipes = run_context.loaded_recipes
end
if recipes.empty? and Chef::Config[:solo]
#If you have roles listed in your run list they are NOT expanded
recipes = node.run_list.map {|item| item.name if item.type == :recipe }
end
recipes.include?(recipe)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment