616490c6eb6b41390e86f6652536fbc704ae4ff1
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / spec_helper_local.rb
1 # automatically load any shared examples or contexts
2 Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
3
4 # hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples
5 RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers)
6
7 RSpec.configure do |config|
8   # supply tests with a possibility to test for the future parser
9   config.add_setting :puppet_future
10   config.puppet_future = Puppet.version.to_f >= 4.0
11
12   config.before :each do
13     # Ensure that we don't accidentally cache facts and environment between
14     # test cases.  This requires each example group to explicitly load the
15     # facts being exercised with something like
16     # Facter.collection.loader.load(:ipaddress)
17     Facter.clear
18     Facter.clear_messages
19     
20     RSpec::Mocks.setup
21   end
22
23   config.after :each do
24     RSpec::Mocks.verify
25     RSpec::Mocks.teardown
26   end
27 end
28
29 # Helper class to test handling of arguments which are derived from string
30 class AlsoString < String
31 end