summaryrefslogtreecommitdiff
path: root/spec/unit/knife/ssl_check_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife/ssl_check_spec.rb')
-rw-r--r--spec/unit/knife/ssl_check_spec.rb17
1 files changed, 4 insertions, 13 deletions
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb
index c7ca98d2dc..d2c33d3ab8 100644
--- a/spec/unit/knife/ssl_check_spec.rb
+++ b/spec/unit/knife/ssl_check_spec.rb
@@ -20,7 +20,6 @@ require "spec_helper"
require "stringio"
describe Chef::Knife::SslCheck do
-
let(:name_args) { [] }
let(:stdout_io) { StringIO.new }
let(:stderr_io) { StringIO.new }
@@ -62,15 +61,14 @@ describe Chef::Knife::SslCheck do
end
context "when an invalid URI is given" do
-
let(:name_args) { %w{foo.test} }
it "prints an error and exits" do
expect { ssl_check.run }.to raise_error(SystemExit)
- expected_stdout=<<-E
+ expected_stdout = <<-E
USAGE: knife ssl check [URL] (options)
E
- expected_stderr=<<-E
+ expected_stderr = <<-E
ERROR: Given URI: `foo.test' is invalid
E
expect(stdout_io.string).to eq(expected_stdout)
@@ -78,15 +76,14 @@ E
end
context "and its malformed enough to make URI.parse barf" do
-
let(:name_args) { %w{ftp://lkj\\blah:example.com/blah} }
it "prints an error and exits" do
expect { ssl_check.run }.to raise_error(SystemExit)
- expected_stdout=<<-E
+ expected_stdout = <<-E
USAGE: knife ssl check [URL] (options)
E
- expected_stderr=<<-E
+ expected_stderr = <<-E
ERROR: Given URI: `#{name_args[0]}' is invalid
E
expect(stdout_io.string).to eq(expected_stdout)
@@ -158,7 +155,6 @@ E
end
context "when the remote host's certificate is valid" do
-
before do
expect(ssl_check).to receive(:verify_X509).and_return(true) # X509 valid certs (no warn)
expect(ssl_socket).to receive(:connect) # no error
@@ -173,7 +169,6 @@ E
end
describe "and the certificate is not valid" do
-
let(:tcp_socket_for_debug) { double(TCPSocket) }
let(:ssl_socket_for_debug) { double(OpenSSL::SSL::SSLSocket) }
@@ -213,7 +208,6 @@ E
expect(stderr).to include("You are attempting to connect to: 'foo.example.com'")
expect(stderr).to include("The server's certificate belongs to 'example.local'")
end
-
end
context "when the cert is not signed by any trusted authority" do
@@ -231,10 +225,7 @@ E
expect { run }.to raise_error(SystemExit)
expect(stderr).to include("The SSL certificate of foo.example.com could not be verified")
end
-
end
end
-
end
-
end