Module: RSpec::Chef::DefineRecipeGroup

Includes:
ChefSupport, JSONSupport, Matchers
Defined in:
lib/rspec-chef/examples/define_recipe_group.rb

Constant Summary

Constants included from Matchers

Matchers::CONTAIN_PATTERN

Instance Method Summary collapse

Methods included from ChefSupport

#lookup_recipe

Methods included from JSONSupport

#json

Methods included from Matchers

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Chef::Matchers

Instance Method Details

#recipeObject



12
13
14
15
16
17
18
19
20
# File 'lib/rspec-chef/examples/define_recipe_group.rb', line 12

def recipe
  ::Chef::Config[:solo] = true
  ::Chef::Config[:cookbook_path] = self.respond_to?(:cookbook_path) ? cookbook_path : RSpec.configuration.cookbook_path
  dna = json(self.respond_to?(:json_attributes) ? json_attributes : RSpec.configuration.json_attributes)

  cookbook_name = self.class.top_level_description.downcase

  lookup_recipe(cookbook_name, ::Chef::Config[:cookbook_path], dna)
end

#subjectObject



8
9
10
# File 'lib/rspec-chef/examples/define_recipe_group.rb', line 8

def subject
  @recipe ||= recipe
end