summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-11-25 13:37:34 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2015-11-25 13:37:34 -0800
commit51297afc41eccf653bededf29fea7ed356feb472 (patch)
tree58d878324153e4eb767f341d79a1b3de2aaf1c57
parentbda78d0ff64f43e5e79424293326d35402fd63d6 (diff)
parent79c7ad25e08b6fdee6df967d9e294ba8c802d4ba (diff)
downloadchef-51297afc41eccf653bededf29fea7ed356feb472.tar.gz
Merge pull request #4206 from chef/lcg/fix-rspec-ctrl-c
fix rspecs-ctrl-c
-rw-r--r--spec/tiny_server.rb4
-rw-r--r--spec/unit/knife/ssl_check_spec.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb
index a2cfe168d5..c28fdc30b3 100644
--- a/spec/tiny_server.rb
+++ b/spec/tiny_server.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2010 Opscode, Inc.
+# Copyright:: Copyright (c) 2010-2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,9 +66,11 @@ module TinyServer
@server = Server.setup(@options) do
run API.instance
end
+ @old_handler = trap(:INT, "EXIT")
@server.start
end
block_until_started
+ trap(:INT, @old_handler)
end
def url
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb
index fd46c47d99..a9d1145f34 100644
--- a/spec/unit/knife/ssl_check_spec.rb
+++ b/spec/unit/knife/ssl_check_spec.rb
@@ -181,7 +181,7 @@ E
let(:self_signed_crt) { OpenSSL::X509::Certificate.new(File.read(self_signed_crt_path)) }
before do
- trap(:INT, "DEFAULT")
+ @old_signal = trap(:INT, "DEFAULT")
expect(TCPSocket).to receive(:new).
with("foo.example.com", 8443).
@@ -191,6 +191,10 @@ E
and_return(ssl_socket_for_debug)
end
+ after do
+ trap(:INT, @old_signal)
+ end
+
context "when the certificate's CN does not match the hostname" do
before do
expect(ssl_check).to receive(:verify_X509).and_return(true) # X509 valid certs