Module: ChefSpec::API::IncludeRecipeMatchers

Defined in:
lib/chefspec/api/include_recipe.rb

Overview

Since:

  • 0.2.1

Instance Method Summary collapse

Instance Method Details

#include_recipe(recipe_name) ⇒ ChefSpec::Matchers::IncludeRecipeMatcher

Assert that a Chef run includes a certain recipe. Given a Chef Recipe that calls include_recipe:

include_recipe 'apache2::default'

The Examples section demonstrates the different ways to test an include_recipe directive with ChefSpec.

Examples:

Assert the apache2::default recipe is included in the Chef run

expect(chef_run).to include_recipe('apache2::default')

Parameters:

  • recipe_name (String)

    the name of the recipe to be included

Returns:

Since:

  • 0.2.1


22
23
24
# File 'lib/chefspec/api/include_recipe.rb', line 22

def include_recipe(recipe_name)
  ChefSpec::Matchers::IncludeRecipeMatcher.new(recipe_name)
end