Class: ChefSpec::Matchers::IncludeRecipeMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/chefspec/matchers/include_recipe_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(recipe_name) ⇒ IncludeRecipeMatcher

Returns a new instance of IncludeRecipeMatcher.



3
4
5
# File 'lib/chefspec/matchers/include_recipe_matcher.rb', line 3

def initialize(recipe_name)
  @recipe_name = with_default(recipe_name)
end

Instance Method Details

#descriptionObject



12
13
14
# File 'lib/chefspec/matchers/include_recipe_matcher.rb', line 12

def description
  %Q{include recipe "#{@recipe_name}"}
end

#failure_messageObject



16
17
18
# File 'lib/chefspec/matchers/include_recipe_matcher.rb', line 16

def failure_message
  %Q{expected #{loaded_recipes.inspect} to include "#{@recipe_name}"}
end

#failure_message_when_negatedObject



20
21
22
# File 'lib/chefspec/matchers/include_recipe_matcher.rb', line 20

def failure_message_when_negated
  %Q{expected "#{@recipe_name}" to not be included}
end

#matches?(runner) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/chefspec/matchers/include_recipe_matcher.rb', line 7

def matches?(runner)
  @runner = runner
  loaded_recipes.include?(@recipe_name)
end