Created
July 5, 2016 08:11
-
-
Save tuxmea/97496e07c2b2cf4bb9e30ea19b215cf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |c| | |
c.before(:each) do | |
# work around https://tickets.puppetlabs.com/browse/PUP-1547 | |
# ensure that there's at least one provider available by emulating that any | |
if Puppet::version < '3.2' | |
# ONLY WORKING WITH PUPPET 2.X !! | |
require 'puppet/provider/confine/exists' | |
Puppet::Provider::Confine::Exists.any_instance.stubs(:which => '') | |
else | |
# ONLY WORKING WITH PUPPET 3.X !! | |
require 'puppet/confine/exists' | |
Puppet::Confine::Exists.any_instance.stubs(:which => '') | |
end | |
# avoid "Only root can execute commands as other users" | |
Puppet.features.stubs(:root? => true) | |
# enable debugging | |
if ENV['PUPPET_DEBUG'] == '1' | |
Puppet::Util::Log.level = :warning | |
Puppet::Util::Log.newdestination(:console) | |
end | |
if ENV['PUPPET_DEBUG'] == '2' | |
Puppet::Util::Log.level = :debug | |
Puppet::Util::Log.newdestination(:console) | |
end | |
end | |
c.config = '/doesnotexist' | |
c.manifest_dir = File.join(fixture_path, 'manifests') | |
c.hiera_config = File.join(fixture_path, 'hiera/hiera.yaml') | |
c.mock_with :mocha | |
c.fail_fast = true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment