spec_helper.rb 950 B

12345678910111213141516171819202122232425262728
  1. dir = File.expand_path(File.dirname(__FILE__))
  2. $LOAD_PATH.unshift File.join(dir, 'lib')
  3. # Don't want puppet getting the command line arguments for rake or autotest
  4. ARGV.clear
  5. require 'puppet'
  6. require 'facter'
  7. require 'mocha'
  8. gem 'rspec', '>=2.0.0'
  9. require 'rspec/expectations'
  10. require 'puppetlabs_spec_helper/module_spec_helper'
  11. RSpec.configure do |config|
  12. # FIXME REVISIT - We may want to delegate to Facter like we do in
  13. # Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) because
  14. # this behavior is a duplication of the spec_helper in Facter.
  15. config.before :each do
  16. # Ensure that we don't accidentally cache facts and environment between
  17. # test cases. This requires each example group to explicitly load the
  18. # facts being exercised with something like
  19. # Facter.collection.loader.load(:ipaddress)
  20. Facter::Util::Loader.any_instance.stubs(:load_all)
  21. Facter.clear
  22. Facter.clear_messages
  23. end
  24. end