Module: ChefSpec::API::Core::ClassMethods Private
- Included in:
- ChefSpec::API::Core
- Defined in:
- lib/chefspec/api/core.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Methods that will end up as group-level.
Instance Method Summary collapse
-
#automatic_attributes ⇒ Chef::Node::VividMash
private
Set automatic-level node attributes to use for this example group.
-
#chefspec_options ⇒ Chef::Node::VividMash
private
Set additional ChefSpec runner options to use for this example group.
-
#default_attributes ⇒ Chef::Node::VividMash
private
Set default-level node attributes to use for this example group.
- #included(klass) ⇒ Object private
-
#normal_attributes ⇒ Chef::Node::VividMash
private
Set normal-level node attributes to use for this example group.
-
#override_attributes ⇒ Chef::Node::VividMash
private
Set override-level node attributes to use for this example group.
-
#platform(name, version = nil) ⇒ void
private
Set the Fauxhai platform to use for this example group.
-
#recipe(&block) ⇒ void
private
Use an in-line block of recipe code for this example group rather than a recipe from a cookbook.
-
#step_into(*resources) ⇒ Array
private
Add resources to the step_into list for this example group.
Instance Method Details
#automatic_attributes ⇒ Chef::Node::VividMash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set automatic-level node attributes to use for this example group.
175 176 177 |
# File 'lib/chefspec/api/core.rb', line 175 def automatic_attributes @chefspec_automatic_attributes ||= Chef::Node::VividMash.new end |
#chefspec_options ⇒ Chef::Node::VividMash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set additional ChefSpec runner options to use for this example group.
185 186 187 |
# File 'lib/chefspec/api/core.rb', line 185 def @chefspec_options ||= Chef::Node::VividMash.new end |
#default_attributes ⇒ Chef::Node::VividMash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set default-level node attributes to use for this example group.
145 146 147 |
# File 'lib/chefspec/api/core.rb', line 145 def default_attributes @chefspec_default_attributes ||= Chef::Node::VividMash.new end |
#included(klass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/chefspec/api/core.rb', line 201 def included(klass) super # Inject classmethods into the group. klass.extend(ClassMethods) # If the describe block is aimed at string or resource/provider class # then set the default subject to be the Chef run. if klass.described_class.nil? || klass.described_class.is_a?(Class) && (klass.described_class < Chef::Resource || klass.described_class < Chef::Provider) klass.subject { chef_run } end end |
#normal_attributes ⇒ Chef::Node::VividMash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set normal-level node attributes to use for this example group.
155 156 157 |
# File 'lib/chefspec/api/core.rb', line 155 def normal_attributes @chefspec_normal_attributes ||= Chef::Node::VividMash.new end |
#override_attributes ⇒ Chef::Node::VividMash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set override-level node attributes to use for this example group.
165 166 167 |
# File 'lib/chefspec/api/core.rb', line 165 def override_attributes @chefspec_override_attributes ||= Chef::Node::VividMash.new end |
#platform(name, version = nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Set the Fauxhai platform to use for this example group.
118 119 120 121 |
# File 'lib/chefspec/api/core.rb', line 118 def platform(name, version = nil) let(:chefspec_platform) { name } let(:chefspec_platform_version) { version } end |
#recipe(&block) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Use an in-line block of recipe code for this example group rather than a recipe from a cookbook.
133 134 135 136 137 |
# File 'lib/chefspec/api/core.rb', line 133 def recipe(&block) let(:chef_run) do chef_runner.converge_block(&block) end end |
#step_into(*resources) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add resources to the step_into list for this example group.
195 196 197 198 |
# File 'lib/chefspec/api/core.rb', line 195 def step_into(*resources) @chefspec_step_into ||= [] @chefspec_step_into |= resources.flatten.map(&:to_s) end |