Révision ece9be27
Do PDK convert
spec/spec_helper.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'puppetlabs_spec_helper/module_spec_helper' |
2 | 4 |
require 'rspec-puppet-facts' |
3 | 5 |
|
... | ... | |
25 | 27 |
end |
26 | 28 |
end |
27 | 29 |
|
30 |
# read default_facts and merge them over what is provided by facterdb |
|
31 |
default_facts.each do |fact, value| |
|
32 |
add_custom_fact fact, value |
|
33 |
end |
|
34 |
|
|
28 | 35 |
RSpec.configure do |c| |
29 | 36 |
c.default_facts = default_facts |
30 | 37 |
c.before :each do |
31 | 38 |
# set to strictest setting for testing |
32 | 39 |
# by default Puppet runs at warning level |
33 | 40 |
Puppet.settings[:strict] = :warning |
41 |
Puppet.settings[:strict_variables] = true |
|
34 | 42 |
end |
35 | 43 |
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] |
36 | 44 |
c.after(:suite) do |
37 | 45 |
end |
38 | 46 |
end |
39 | 47 |
|
48 |
# Ensures that a module is defined |
|
49 |
# @param module_name Name of the module |
|
40 | 50 |
def ensure_module_defined(module_name) |
41 | 51 |
module_name.split('::').reduce(Object) do |last_module, next_module| |
42 | 52 |
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) |
Formats disponibles : Unified diff