Skip to content

Commit

Permalink
Merge pull request #389 from ekohl/use-rspec-puppet-settings
Browse files Browse the repository at this point in the history
Use rspec-puppet settings to configure Puppet
  • Loading branch information
chelnak authored Apr 25, 2023
2 parents 1f86cf6 + 82f3760 commit dcdd939
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/puppetlabs_spec_helper/module_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ def verify_contents(subject, title, expected_lines)
c.module_path = module_path
c.manifest_dir = File.join(fixture_path, 'manifests')

# https://github.com/puppetlabs/rspec-puppet#strict_variables
c.strict_variables = ENV['STRICT_VARIABLES'] != 'no'
# https://github.com/puppetlabs/rspec-puppet#ordering
c.ordering = ENV['ORDERING'] if ENV['ORDERING']

c.before :each do
if c.mock_framework.framework_name == :rspec
allow(Puppet.features).to receive(:root?).and_return(true)
else
Puppet.features.stubs(:root?).returns(true)
end

Puppet.settings[:strict_variables] = true if ENV['STRICT_VARIABLES'] == 'yes' || ENV['STRICT_VARIABLES'] != 'no'
Puppet.settings[:ordering] = ENV['ORDERING'] if ENV['ORDERING']
end
end

0 comments on commit dcdd939

Please sign in to comment.