| Class | RSpec::Puppet::Adapters::Base |
| In: |
lib/rspec-puppet/adapters.rb
|
| Parent: | Object |
Set up a specific Puppet setting. configuration setting.
Puppet setting values can be taken from the global RSpec configuration, or from the currently executing RSpec context. When a setting is specified both in the global configuration and in the example group, the setting in the example group is preferred.
@example Configuring a Puppet setting from a global RSpec configuration value
RSpec.configure do |config|
config.parser = "future"
end
# => Puppet[:parser] will be future
@example Configuring a Puppet setting from within an RSpec example group
RSpec.describe 'my_module::my_class', :type => :class do
let(:module_path) { "/Users/luke/modules" }
#=> Puppet[:modulepath] will be "/Users/luke/modules"
end
@example Configuring a Puppet setting with both a global RSpec configuration and local context
RSpec.configure do |config|
config.confdir = "/etc/puppet"
end
RSpec.describe 'my_module', :type => :class do
# Puppet[:confdir] will be "/etc/puppet"
end
RSpec.describe 'my_module::my_class', :type => :class do
let(:confdir) { "/etc/puppetlabs/puppet" }
# => Puppet[:confdir] will be "/etc/puppetlabs/puppet" in this example group
end
RSpec.describe 'my_module::my_define', :type => :define do
# Puppet[:confdir] will be "/etc/puppet" again
end
@param example_group [RSpec::Core::ExampleGroup] The RSpec context to use for local settings @param puppet_setting [Symbol] The name of the Puppet setting to configure @param rspec_setting [Symbol] The name of the RSpec context specific or global setting to use @return [void]