class ChefSpec::Matchers::IncludeAnyRecipeMatcher
Public Instance Methods
description()
click to toggle source
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 8 def description "include any recipe" end
failure_message()
click to toggle source
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 12 def failure_message "expected to include any recipe" end
failure_message_when_negated()
click to toggle source
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 16 def failure_message_when_negated "expected not to include any recipes" end
matches?(runner)
click to toggle source
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 3 def matches?(runner) @runner = runner !(loaded_recipes - run_list_recipes).empty? end
Private Instance Methods
loaded_recipes()
click to toggle source
The list of loaded recipes on the Chef
run (normalized)
@return [Array<String>]
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 47 def loaded_recipes @runner.run_context.loaded_recipes.map { |name| with_default(name) } end
run_list_recipes()
click to toggle source
The list of run_list recipes on the Chef
run (normalized)
@return [Array<String>]
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 27 def run_list_recipes @runner.run_context.node.run_list.run_list_items.map { |x| with_default(x.name) } end
with_default(name)
click to toggle source
Automatically appends “::default
” to recipes that need them.
@param [String] name
@return [String]
# File lib/chefspec/matchers/include_any_recipe_matcher.rb, line 38 def with_default(name) name.include?("::") ? name : "#{name}::default" end