summaryrefslogtreecommitdiff
path: root/spec/spec_helper_local.rb
diff options
context:
space:
mode:
authorHelen <helen@puppetlabs.com>2016-04-15 13:29:23 +0100
committerHelen <helen@puppetlabs.com>2016-04-15 13:29:23 +0100
commitd9f65387c99c99177f94075fc840e7c574e07417 (patch)
treee2b1bf7362973650efdcac0a3be68df7d9bae8f6 /spec/spec_helper_local.rb
parent29961218a74bfdae96371c42a3c336e714c79a93 (diff)
parent085035dccebbf27cf2bfd7f1d9101c746f5178a2 (diff)
Merge pull request #595 from tphoney/4.12.0_release
master to 4.12.x
Diffstat (limited to 'spec/spec_helper_local.rb')
-rw-r--r--spec/spec_helper_local.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb
new file mode 100644
index 0000000..023a862
--- /dev/null
+++ b/spec/spec_helper_local.rb
@@ -0,0 +1,29 @@
+
+# hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples
+RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers)
+
+RSpec.configure do |config|
+ # supply tests with a possibility to test for the future parser
+ config.add_setting :puppet_future
+ 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
+ # facts being exercised with something like
+ # Facter.collection.loader.load(:ipaddress)
+ Facter.clear
+ Facter.clear_messages
+
+ RSpec::Mocks.setup
+ end
+
+ config.after :each do
+ RSpec::Mocks.verify
+ RSpec::Mocks.teardown
+ end
+end
+
+# Helper class to test handling of arguments which are derived from string
+class AlsoString < String
+end