]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
spec_helper: implement an easy way for specs to confine to puppet version
authorDavid Schmitt <david.schmitt@puppetlabs.com>
Mon, 1 Jun 2015 11:21:59 +0000 (12:21 +0100)
committerDavid Schmitt <david.schmitt@puppetlabs.com>
Mon, 1 Jun 2015 11:21:59 +0000 (12:21 +0100)
Usage:

    describe 'puppet3 behaviour', :unless => RSpec.configuration.puppet_future do
    describe 'puppet4 behaviour', :if => RSpec.configuration.puppet_future do

spec/spec_helper.rb

index ccc4d95722df441c0002cb415b05a8a9be5805f2..be392fd02d5dd7d96961be059d84966940e2d421 100755 (executable)
@@ -23,6 +23,10 @@ require 'mocha/api'
 RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers)
 
 RSpec.configure do |config|
+  config.add_setting :puppet_future
+  #config.puppet_future = (ENV['FUTURE_PARSER'] == 'yes' or Puppet.version.to_f >= 4.0)
+  config.puppet_future = Puppet.version.to_f >= 4.0
+
   config.before :each do
     # Ensure that we don't accidentally cache facts and environment between
     # test cases.  This requires each example group to explicitly load the