diff options
Diffstat (limited to 'spec/unit/http')
-rw-r--r-- | spec/unit/http/authenticator_spec.rb | 10 | ||||
-rw-r--r-- | spec/unit/http/basic_client_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/http/http_request_spec.rb | 42 | ||||
-rw-r--r-- | spec/unit/http/json_input_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/http/simple_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/http/socketless_chef_zero_client_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/http/ssl_policies_spec.rb | 20 | ||||
-rw-r--r-- | spec/unit/http/validate_content_length_spec.rb | 6 |
8 files changed, 45 insertions, 45 deletions
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb index 48bbdcf76c..1289ebb61e 100644 --- a/spec/unit/http/authenticator_spec.rb +++ b/spec/unit/http/authenticator_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/http/authenticator' +require "spec_helper" +require "chef/http/authenticator" describe Chef::HTTP::Authenticator do let(:class_instance) { Chef::HTTP::Authenticator.new } @@ -35,15 +35,15 @@ describe Chef::HTTP::Authenticator do it "merges the default version of X-Ops-Server-API-Version into the headers" do # headers returned expect(class_instance.handle_request(method, url, headers, data)[2]). - to include({'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}) + to include({"X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}) end context "when api_version is set to something other than the default" do - let(:class_instance) { Chef::HTTP::Authenticator.new({:api_version => '-10'}) } + let(:class_instance) { Chef::HTTP::Authenticator.new({:api_version => "-10"}) } it "merges the requested version of X-Ops-Server-API-Version into the headers" do expect(class_instance.handle_request(method, url, headers, data)[2]). - to include({'X-Ops-Server-API-Version' => '-10'}) + to include({"X-Ops-Server-API-Version" => "-10"}) end end end diff --git a/spec/unit/http/basic_client_spec.rb b/spec/unit/http/basic_client_spec.rb index 16f62f8d97..4abdb52620 100644 --- a/spec/unit/http/basic_client_spec.rb +++ b/spec/unit/http/basic_client_spec.rb @@ -15,8 +15,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/http/basic_client' +require "spec_helper" +require "chef/http/basic_client" describe "HTTP Connection" do diff --git a/spec/unit/http/http_request_spec.rb b/spec/unit/http/http_request_spec.rb index 3bba201963..33da210c36 100644 --- a/spec/unit/http/http_request_spec.rb +++ b/spec/unit/http/http_request_spec.rb @@ -16,40 +16,40 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::HTTP::HTTPRequest do context "with HTTP url scheme" do it "should not include port 80 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com"), "") - expect(request.headers['Host']).to eql('dummy.com') + expect(request.headers["Host"]).to eql("dummy.com") end it "should not include explicit port 80 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:80'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:80"), "") - expect(request.headers['Host']).to eql('dummy.com') + expect(request.headers["Host"]).to eql("dummy.com") end it "should include explicit port 8000 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "") - expect(request.headers['Host']).to eql('dummy.com:8000') + expect(request.headers["Host"]).to eql("dummy.com:8000") end it "should include explicit 443 port in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:443'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:443"), "") - expect(request.headers['Host']).to eql('dummy.com:443') + expect(request.headers["Host"]).to eql("dummy.com:443") end it "should pass on explicit Host header unchanged" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '', { 'Host' => 'yourhost.com:8888' }) + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "", { "Host" => "yourhost.com:8888" }) - expect(request.headers['Host']).to eql('yourhost.com:8888') + expect(request.headers["Host"]).to eql("yourhost.com:8888") end end @@ -57,35 +57,35 @@ describe Chef::HTTP::HTTPRequest do context "with HTTPS url scheme" do it "should not include port 443 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com"), "") - expect(request.headers['Host']).to eql('dummy.com') + expect(request.headers["Host"]).to eql("dummy.com") end it "should include explicit port 80 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:80'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:80"), "") - expect(request.headers['Host']).to eql('dummy.com:80') + expect(request.headers["Host"]).to eql("dummy.com:80") end it "should include explicit port 8000 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:8000'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:8000"), "") - expect(request.headers['Host']).to eql('dummy.com:8000') + expect(request.headers["Host"]).to eql("dummy.com:8000") end it "should not include explicit port 443 in Host header" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:443'), '') + request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:443"), "") - expect(request.headers['Host']).to eql('dummy.com') + expect(request.headers["Host"]).to eql("dummy.com") end end it "should pass on explicit Host header unchanged" do - request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '', { 'Host' => 'myhost.com:80' }) + request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "", { "Host" => "myhost.com:80" }) - expect(request.headers['Host']).to eql('myhost.com:80') + expect(request.headers["Host"]).to eql("myhost.com:80") end end diff --git a/spec/unit/http/json_input_spec.rb b/spec/unit/http/json_input_spec.rb index fbf8f22503..6bc2bbf018 100644 --- a/spec/unit/http/json_input_spec.rb +++ b/spec/unit/http/json_input_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/http/json_input' +require "spec_helper" +require "chef/http/json_input" describe Chef::HTTP::JSONInput do diff --git a/spec/unit/http/simple_spec.rb b/spec/unit/http/simple_spec.rb index c8fb52e8b2..f132f1a890 100644 --- a/spec/unit/http/simple_spec.rb +++ b/spec/unit/http/simple_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::HTTP::Simple do it "should have content length validation middleware after compressor middleware" do diff --git a/spec/unit/http/socketless_chef_zero_client_spec.rb b/spec/unit/http/socketless_chef_zero_client_spec.rb index 963cc9e8c4..b65deafe53 100644 --- a/spec/unit/http/socketless_chef_zero_client_spec.rb +++ b/spec/unit/http/socketless_chef_zero_client_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'chef/http/socketless_chef_zero_client' +require "chef/http/socketless_chef_zero_client" describe Chef::HTTP::SocketlessChefZeroClient do diff --git a/spec/unit/http/ssl_policies_spec.rb b/spec/unit/http/ssl_policies_spec.rb index 5ebebf39b1..98f1fa9c37 100644 --- a/spec/unit/http/ssl_policies_spec.rb +++ b/spec/unit/http/ssl_policies_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/http/ssl_policies' +require "spec_helper" +require "chef/http/ssl_policies" describe "HTTP SSL Policy" do @@ -68,8 +68,8 @@ describe "HTTP SSL Policy" do end it "should set the CA file if that is set in the configuration" do - Chef::Config[:ssl_ca_file] = CHEF_SPEC_DATA + '/ssl/5e707473.0' - expect(http_client.ca_file).to eq(CHEF_SPEC_DATA + '/ssl/5e707473.0') + Chef::Config[:ssl_ca_file] = CHEF_SPEC_DATA + "/ssl/5e707473.0" + expect(http_client.ca_file).to eq(CHEF_SPEC_DATA + "/ssl/5e707473.0") end end @@ -89,12 +89,12 @@ describe "HTTP SSL Policy" do it "raises ConfigurationError if the certificate file doesn't exist" do Chef::Config[:ssl_client_cert] = "/dev/null/nothing_here" - Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + '/ssl/chef-rspec.key' + Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + "/ssl/chef-rspec.key" expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError) end it "raises ConfigurationError if the certificate file doesn't exist" do - Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + '/ssl/chef-rspec.cert' + Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + "/ssl/chef-rspec.cert" Chef::Config[:ssl_client_key] = "/dev/null/nothing_here" expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError) end @@ -106,10 +106,10 @@ describe "HTTP SSL Policy" do end it "configures the HTTP client's cert and private key" do - Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + '/ssl/chef-rspec.cert' - Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + '/ssl/chef-rspec.key' - expect(http_client.cert.to_s).to eq(OpenSSL::X509::Certificate.new(IO.read(CHEF_SPEC_DATA + '/ssl/chef-rspec.cert')).to_s) - expect(http_client.key.to_s).to eq(IO.read(CHEF_SPEC_DATA + '/ssl/chef-rspec.key')) + Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + "/ssl/chef-rspec.cert" + Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + "/ssl/chef-rspec.key" + expect(http_client.cert.to_s).to eq(OpenSSL::X509::Certificate.new(IO.read(CHEF_SPEC_DATA + "/ssl/chef-rspec.cert")).to_s) + expect(http_client.key.to_s).to eq(IO.read(CHEF_SPEC_DATA + "/ssl/chef-rspec.key")) end end diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb index 16eede1859..18b0bead70 100644 --- a/spec/unit/http/validate_content_length_spec.rb +++ b/spec/unit/http/validate_content_length_spec.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'spec_helper' -require 'stringio' +require "spec_helper" +require "stringio" describe Chef::HTTP::ValidateContentLength do class TestClient < Chef::HTTP @@ -44,7 +44,7 @@ describe Chef::HTTP::ValidateContentLength do } let(:response) { - m = double('HttpResponse', :body => response_body) + m = double("HttpResponse", :body => response_body) allow(m).to receive(:[]) do |key| response_headers[key] end |