summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-21 12:03:13 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-21 12:37:25 -0700
commit7414ee7ebda1052f4c52f3e5565726f20de5a20b (patch)
treef290c3f7d4abfbf0af6ca3dc0f56c4fa923ec2aa
parent03bd5595365b7d541d20ed614e9c8be6a7cba9c9 (diff)
downloadpuppet-7414ee7ebda1052f4c52f3e5565726f20de5a20b.tar.gz
puppet-7414ee7ebda1052f4c52f3e5565726f20de5a20b.tar.xz
puppet-7414ee7ebda1052f4c52f3e5565726f20de5a20b.zip
maint: better disabling of Signal#trap in our tests.
We tried to stub out the trap method on signal to stop our application level signal handlers getting in the way, but it kept not sticking. Now, instead, we just stub it out globally at the module level in our spec helper. Less fun, but more effective. Until rspec starts installing a signal handler, at least. :)
-rw-r--r--spec/monkey_patches/disable_signal_trap.rb5
-rwxr-xr-xspec/spec_helper.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/spec/monkey_patches/disable_signal_trap.rb b/spec/monkey_patches/disable_signal_trap.rb
new file mode 100644
index 000000000..5159626e3
--- /dev/null
+++ b/spec/monkey_patches/disable_signal_trap.rb
@@ -0,0 +1,5 @@
+module Signal
+ def trap(*args)
+ # The goggles, they do nothing!
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b04ec6ffd..01ffabc48 100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -22,6 +22,7 @@ require 'lib/puppet_spec/files'
require 'lib/puppet_spec/fixtures'
require 'monkey_patches/alias_should_to_must'
require 'monkey_patches/publicize_methods'
+require 'monkey_patches/disable_signal_trap'
Pathname.glob("#{dir}/shared_behaviours/**/*.rb") do |behaviour|
require behaviour.relative_path_from(Pathname.new(dir))
@@ -38,6 +39,10 @@ RSpec.configure do |config|
# these globals are set by Application
$puppet_application_mode = nil
$puppet_application_name = nil
+
+ # REVISIT: I think this conceals other bad tests, but I don't have time to
+ # fully diagnose those right now. When you read this, please come tell me
+ # I suck for letting this float. --daniel 2011-04-21
Signal.stubs(:trap)
# Set the confdir and vardir to gibberish so that tests