module ChefSpec::API::Core
def chef_runner_class
-
(Class)-
Other tags:
- Abstract: -
def chef_runner_class ChefSpec::SoloRunner end
def chef_runner_instance
-
(ChefSpec::SoloRunner)-
def chef_runner_instance chef_runner_class.new(chef_runner_options) end
def chef_runner_options
-
(Hash-)
Other tags:
- Abstract: -
def chef_runner_options options = { step_into: chefspec_ancestor_gather([], :step_into) { |memo, val| memo | val }, default_attributes: chefspec_default_attributes, normal_attributes: chefspec_normal_attributes, override_attributes: chefspec_override_attributes, automatic_attributes: chefspec_automatic_attributes, spec_declaration_locations: self.class.declaration_locations.last[0], } # Only specify these if set in the example so we don't override the # global settings. options[:platform] = chefspec_platform if chefspec_platform options[:version] = chefspec_platform_version if chefspec_platform_version # Merge in any final overrides. options.update(chefspec_attributes(:chefspec_options).symbolize_keys) options end
def chefspec_ancestor_gather(start, method, &block)
-
(Object)-
Parameters:
-
block(Proc) -- Reducer callable. -
method(Symbol) -- Name of the group-level method to call on each -
start(Object) -- Initial value for the reducer.
Other tags:
- Api: - private
def chefspec_ancestor_gather(start, method, &block) candidate_ancestors = self.class.ancestors.select { |cls| cls.respond_to?(method) && cls != ChefSpec::API::Core } candidate_ancestors.reverse.inject(start) do |memo, cls| block.call(memo, cls.send(method)) end end
def chefspec_attributes(method)
-
(Mash)-
Parameters:
-
method(Symbol) -- Name of the group-level method to call on each
Other tags:
- Api: - private
def chefspec_attributes(method) chefspec_ancestor_gather(Mash.new, method) do |memo, val| Chef::Mixin::DeepMerge.merge(memo, val) end end