Also removed some monkey patching on Signal that would have
theoretically done this without having to explicitly call trap on Signal
in order to stub it, but it's not working.

This allows us to ctrl+c (send SIGINT) in the middle of a spec run.

Paired-with: Josh Cooper <[email protected]>
Signed-off-by: Matt Robinson <[email protected]>
---
Local-branch: ticket/2.7.next/maint-stub_trap
 lib/puppet/application/device.rb           |    2 +-
 spec/monkey_patches/disable_signal_trap.rb |    5 -----
 spec/spec_helper.rb                        |    1 -
 spec/unit/application/device_spec.rb       |    2 +-
 4 files changed, 2 insertions(+), 8 deletions(-)
 delete mode 100644 spec/monkey_patches/disable_signal_trap.rb

diff --git a/lib/puppet/application/device.rb b/lib/puppet/application/device.rb
index df5bac2..3e2dec9 100644
--- a/lib/puppet/application/device.rb
+++ b/lib/puppet/application/device.rb
@@ -11,7 +11,7 @@ class Puppet::Application::Device < Puppet::Application
 
   def preinit
     # Do an initial trap, so that cancels don't get a stack trace.
-    trap(:INT) do
+    Signal.trap(:INT) do
       $stderr.puts "Cancelling startup"
       exit(0)
     end
diff --git a/spec/monkey_patches/disable_signal_trap.rb 
b/spec/monkey_patches/disable_signal_trap.rb
deleted file mode 100644
index 5159626..0000000
--- a/spec/monkey_patches/disable_signal_trap.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-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 6b6b1c2..79fda18 100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -23,7 +23,6 @@ require 'puppet_spec/fixtures'
 require 'puppet_spec/matchers'
 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))
diff --git a/spec/unit/application/device_spec.rb 
b/spec/unit/application/device_spec.rb
index 464827e..42a62da 100755
--- a/spec/unit/application/device_spec.rb
+++ b/spec/unit/application/device_spec.rb
@@ -39,7 +39,7 @@ describe Puppet::Application::Device do
     end
 
     it "should catch INT" do
-      @device.expects(:trap).with { |arg,block| arg == :INT }
+      Signal.expects(:trap).with { |arg,block| arg == :INT }
 
       @device.preinit
     end
-- 
1.7.3.1

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

Reply via email to