summaryrefslogtreecommitdiffstats
path: root/spec/unit/application/queue_spec.rb
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-02-15 17:10:42 -0800
committerMatt Robinson <matt@puppetlabs.com>2011-02-16 15:13:31 -0800
commit7cb884e44db412ed4cc19d9eb3e07d4b5b17f6b3 (patch)
tree783ca4c23a65eef0201e08925221f63458a0c31c /spec/unit/application/queue_spec.rb
parent9b7b0f3ad87abc3a6fbb7ad128e942571cd3e71a (diff)
downloadpuppet-7cb884e44db412ed4cc19d9eb3e07d4b5b17f6b3.tar.gz
puppet-7cb884e44db412ed4cc19d9eb3e07d4b5b17f6b3.tar.xz
puppet-7cb884e44db412ed4cc19d9eb3e07d4b5b17f6b3.zip
(#6346) Move the trap calls onto Signal so they're easier to stub
Once you stub signal traps in tests, you can hit ctrl+c in the middle of a spec run and it will stop the run instead of puppet catching the SIGINT. I had trouble easily tracking down all the places to stub traps when the trap was being called as a private method on applications and daemons, but calling trap on Signal is equivalent since Kernel calls Signal.trap and Object mixes in Kernel to provide trap as a private method on all objects. A bigger solution would be to refactor everywhere we call trap into a method that's called consistently since right now we sprinkle SIGINT and SIGTERM trap handling over applications and daemons in inconsistent ways, returning different error codes and using different messages. I've captured this info in ticket #6345. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/application/queue_spec.rb')
-rwxr-xr-xspec/unit/application/queue_spec.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb
index bd0d53ab1..f8ebbd0b4 100755
--- a/spec/unit/application/queue_spec.rb
+++ b/spec/unit/application/queue_spec.rb
@@ -29,12 +29,8 @@ describe Puppet::Application::Queue do
end
describe "in preinit" do
- before :each do
- @queue.stubs(:trap)
- end
-
it "should catch INT" do
- @queue.expects(:trap).with { |arg,block| arg == :INT }
+ Signal.expects(:trap).with { |arg,block| arg == :INT }
@queue.preinit
end