summaryrefslogtreecommitdiff
path: root/spec/unit/http
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/http')
-rw-r--r--spec/unit/http/authenticator_spec.rb8
-rw-r--r--spec/unit/http/json_input_spec.rb6
-rw-r--r--spec/unit/http/socketless_chef_zero_client_spec.rb3
-rw-r--r--spec/unit/http/ssl_policies_spec.rb13
-rw-r--r--spec/unit/http/validate_content_length_spec.rb6
5 files changed, 17 insertions, 19 deletions
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb
index 3650e99a02..7fd2bdc821 100644
--- a/spec/unit/http/authenticator_spec.rb
+++ b/spec/unit/http/authenticator_spec.rb
@@ -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
@@ -72,7 +72,7 @@ describe Chef::HTTP::Authenticator do
it "calls authentication_headers with the proper input" do
expect(class_instance).to receive(:authentication_headers).with(
method, url, data,
- {"X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}).and_return({})
+ { "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }).and_return({})
class_instance.handle_request(method, url, headers, data)
end
end
diff --git a/spec/unit/http/json_input_spec.rb b/spec/unit/http/json_input_spec.rb
index e26e030737..a76c8d1dc7 100644
--- a/spec/unit/http/json_input_spec.rb
+++ b/spec/unit/http/json_input_spec.rb
@@ -66,7 +66,7 @@ describe Chef::HTTP::JSONInput do
context "when the request should be serialized" do
let(:http_method) { :put }
- let(:data) { {foo: "bar"} }
+ let(:data) { { foo: "bar" } }
let(:expected_data) { %q[{"foo":"bar"}] }
context "and the request has a ruby object as the body and no explicit content-type" do
@@ -111,7 +111,7 @@ describe Chef::HTTP::JSONInput do
expect(handle_request).to eq([http_method, url, headers, data])
# not normalized
- expect(headers).to eq({"content-type" => "application/x-binary"})
+ expect(headers).to eq({ "content-type" => "application/x-binary" })
end
it "does not serialize the body to json when content type is given in capitalized form" do
@@ -120,7 +120,7 @@ describe Chef::HTTP::JSONInput do
expect(handle_request).to eq([http_method, url, headers, data])
# not normalized
- expect(headers).to eq({"Content-Type" => "application/x-binary"})
+ expect(headers).to eq({ "Content-Type" => "application/x-binary" })
end
end
diff --git a/spec/unit/http/socketless_chef_zero_client_spec.rb b/spec/unit/http/socketless_chef_zero_client_spec.rb
index 4b45582ec4..637e562799 100644
--- a/spec/unit/http/socketless_chef_zero_client_spec.rb
+++ b/spec/unit/http/socketless_chef_zero_client_spec.rb
@@ -110,7 +110,7 @@ describe Chef::HTTP::SocketlessChefZeroClient do
end
it "does not fail when calling read_body with a block" do
- expect(net_http_response.read_body {|chunk| chunk }).to eq("bunch o' JSON")
+ expect(net_http_response.read_body { |chunk| chunk }).to eq("bunch o' JSON")
end
end
@@ -149,7 +149,6 @@ describe Chef::HTTP::SocketlessChefZeroClient do
}
end
-
let(:response_code) { 200 }
let(:response_headers) { { "Content-Type" => "Application/JSON" } }
let(:response_body) { [ "bunch o' JSON" ] }
diff --git a/spec/unit/http/ssl_policies_spec.rb b/spec/unit/http/ssl_policies_spec.rb
index 7dbe06ee8e..df6dee1198 100644
--- a/spec/unit/http/ssl_policies_spec.rb
+++ b/spec/unit/http/ssl_policies_spec.rb
@@ -54,7 +54,7 @@ describe "HTTP SSL Policy" do
it "raises a ConfigurationError if :ssl_ca_path is set to a path that doesn't exist" do
Chef::Config[:ssl_ca_path] = "/dev/null/nothing_here"
- expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
+ expect { http_client }.to raise_error(Chef::Exceptions::ConfigurationError)
end
it "should set the CA path if that is set in the configuration" do
@@ -64,7 +64,7 @@ describe "HTTP SSL Policy" do
it "raises a ConfigurationError if :ssl_ca_file is set to a file that does not exist" do
Chef::Config[:ssl_ca_file] = "/dev/null/nothing_here"
- expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
+ expect { http_client }.to raise_error(Chef::Exceptions::ConfigurationError)
end
it "should set the CA file if that is set in the configuration" do
@@ -85,24 +85,24 @@ describe "HTTP SSL Policy" do
end
describe "when configured with a client certificate" do
- before {@url = URI.parse("https://chef.example.com:4443/")}
+ before { @url = URI.parse("https://chef.example.com:4443/") }
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"
- expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
+ 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_key] = "/dev/null/nothing_here"
- expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
+ expect { http_client }.to raise_error(Chef::Exceptions::ConfigurationError)
end
it "raises a ConfigurationError if one of :ssl_client_cert and :ssl_client_key is set but not both" do
Chef::Config[:ssl_client_cert] = "/dev/null/nothing_here"
Chef::Config[:ssl_client_key] = nil
- expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
+ expect { http_client }.to raise_error(Chef::Exceptions::ConfigurationError)
end
it "configures the HTTP client's cert and private key" do
@@ -167,4 +167,3 @@ describe "HTTP SSL Policy" do
end
end
-
diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb
index 00f69c7e6f..c054529e48 100644
--- a/spec/unit/http/validate_content_length_spec.rb
+++ b/spec/unit/http/validate_content_length_spec.rb
@@ -29,7 +29,7 @@ describe Chef::HTTP::ValidateContentLength do
let(:headers) { {} }
let(:data) { false }
- let(:request) { }
+ let(:request) {}
let(:return_value) { "200" }
# Test Variables
@@ -105,7 +105,7 @@ describe Chef::HTTP::ValidateContentLength do
end
describe "without Content-Length header" do
- let(:response_headers) { { } }
+ let(:response_headers) { {} }
[ "direct", "streaming" ].each do |req_type|
describe "when running #{req_type} request" do
@@ -180,7 +180,7 @@ describe Chef::HTTP::ValidateContentLength do
end
it "should reset internal counter" do
- expect(middleware.instance_variable_get(:@content_length_counter)).to be_nil
+ expect(middleware.instance_variable_get(:@content_length_counter)).to be_nil
end
it "should validate correctly second time" do