summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickaël Canévet <mickael.canevet@camptocamp.com>2014-04-30 13:40:19 +0200
committerMickaël Canévet <mickael.canevet@camptocamp.com>2014-04-30 14:49:24 +0200
commitf1dd40883fabce8bdbc4e714bd890af054beb952 (patch)
tree11b8e46d7438887bf5073a87a0facb443a8af257
parentaf3579657c277fb99274758b7a5a16c7ad58cbb2 (diff)
Add strict variables tests
-rw-r--r--.travis.yml26
-rw-r--r--spec/spec_helper.rb27
2 files changed, 49 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index e3ebbb8..7480714 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,14 +11,17 @@ after_success:
rvm:
- 1.8.7
- 1.9.3
+ - 2.0.0
+ - 2.1.1
env:
matrix:
- - PUPPET_GEM_VERSION="~> 3.5.1"
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.0"
+ - PUPPET_GEM_VERSION="~> 3.4.0"
+ - PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
global:
- PUBLISHER_LOGIN=saz
- secure: |-
@@ -26,13 +29,28 @@ env:
JaSoYgjQpCILvniWg76o+HY1bTDEP3AmUlxNFgfDAOAQfv0RHv2cEcgNxNrxsddx6S
Ks0FCvVkFgY703X+kBiYTpjP4SBzRe0y9OudSvk=
matrix:
- include:
+ fast_finish: true
+ exclude:
+ - rvm: 1.9.3
+ env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
- env: PUPPET_GEM_VERSION="~> 3.5.1"
+ env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
- env: PUPPET_GEM_VERSION="~> 3.2.0"
+ env: PUPPET_GEM_VERSION="~> 3.0.0"
- rvm: 2.0.0
+ env: PUPPET_GEM_VERSION="~> 3.1.0"
+ - rvm: 2.1.1
+ env: PUPPET_GEM_VERSION="~> 2.7.0"
+ - rvm: 2.1.1
+ env: PUPPET_GEM_VERSION="~> 3.0.0"
+ - rvm: 2.1.1
+ env: PUPPET_GEM_VERSION="~> 3.1.0"
+ - rvm: 2.1.1
+ env: PUPPET_GEM_VERSION="~> 3.2.0"
+ - rvm: 2.1.1
env: PUPPET_GEM_VERSION="~> 3.3.0"
+ - rvm: 2.1.1
+ env: PUPPET_GEM_VERSION="~> 3.4.0"
notifications:
email: false
gemfile: .gemfile
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2c6f566..a05654b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1 +1,28 @@
require 'puppetlabs_spec_helper/module_spec_helper'
+
+RSpec.configure do |c|
+ c.mock_with :rspec do |mock|
+ mock.syntax = [:expect, :should]
+ end
+ c.include PuppetlabsSpec::Files
+
+ c.before :each do
+ # Ensure that we don't accidentally cache facts and environment
+ # between test cases.
+ Facter::Util::Loader.any_instance.stubs(:load_all)
+ Facter.clear
+ Facter.clear_messages
+
+ # Store any environment variables away to be restored later
+ @old_env = {}
+ ENV.each_key {|k| @old_env[k] = ENV[k]}
+
+ if ENV['STRICT_VARIABLES'] == 'yes'
+ Puppet.settings[:strict_variables]=true
+ end
+ end
+
+ c.after :each do
+ PuppetlabsSpec::Files.cleanup
+ end
+end