From: Daniel Pittman <dan...@rimspace.net>

with_verbose_disabled allows you to run tests that muck with constans
without getting spammy warnings.

Reviewed-by: Max Martin and Matt Robinson

Signed-off-by: Max Martin <m...@puppetlabs.com>
---
 spec/lib/puppet_spec/verbose.rb |    9 +++++++++
 spec/spec_helper.rb             |    6 ++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
 create mode 100644 spec/lib/puppet_spec/verbose.rb

diff --git a/spec/lib/puppet_spec/verbose.rb b/spec/lib/puppet_spec/verbose.rb
new file mode 100644
index 0000000..d9834f2
--- /dev/null
+++ b/spec/lib/puppet_spec/verbose.rb
@@ -0,0 +1,9 @@
+# Support code for running stuff with warnings disabled.
+module Kernel
+  def with_verbose_disabled
+    verbose, $VERBOSE = $VERBOSE, nil
+    result = yield
+    $VERBOSE = verbose
+    return result
+  end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ae4edb2..505a8f9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -23,10 +23,16 @@ end
 module PuppetTest
 end
 
+require 'pathname'
+require 'lib/puppet_spec/verbose'
 require 'lib/puppet_spec/files'
 require 'monkey_patches/alias_should_to_must'
 require 'monkey_patches/publicize_methods'
 
+Pathname.glob("#{dir}/shared_behaviours/**/*.rb") do |behaviour|
+  require behaviour.relative_path_from(Pathname.new(dir))
+end
+
 RSpec.configure do |config|
   config.mock_with :mocha
 
-- 
1.7.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to