spec_helper_local.rb 994 B

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