diff options
Diffstat (limited to 'spec/unit/http')
-rw-r--r-- | spec/unit/http/api_versions_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/http/authenticator_spec.rb | 34 | ||||
-rw-r--r-- | spec/unit/http/ssl_policies_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/http/validate_content_length_spec.rb | 4 |
4 files changed, 21 insertions, 21 deletions
diff --git a/spec/unit/http/api_versions_spec.rb b/spec/unit/http/api_versions_spec.rb index 2ccb847acc..2b52e87cae 100644 --- a/spec/unit/http/api_versions_spec.rb +++ b/spec/unit/http/api_versions_spec.rb @@ -43,7 +43,7 @@ describe Chef::HTTP::APIVersions do end let(:response) do - m = double("HttpResponse", :body => response_body) + m = double("HttpResponse", body: response_body) allow(m).to receive(:key?).with("x-ops-server-api-version").and_return(true) allow(m).to receive(:code).and_return(return_value) allow(m).to receive(:[]) do |key| diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb index 548fc0158c..4a919ad492 100644 --- a/spec/unit/http/authenticator_spec.rb +++ b/spec/unit/http/authenticator_spec.rb @@ -34,8 +34,8 @@ 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 }) + expect(class_instance.handle_request(method, url, headers, data)[2]) + .to include({ "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }) end context "when version_class is provided" do @@ -53,17 +53,17 @@ describe Chef::HTTP::Authenticator do it "uses it to select the correct http version" do Chef::ServerAPIVersions.instance.reset! expect(AuthFactoryClass).to receive(:best_request_version).and_call_original - expect(class_instance.handle_request(method, url, headers, data)[2]). - to include({ "X-Ops-Server-API-Version" => "2" }) + expect(class_instance.handle_request(method, url, headers, data)[2]) + .to include({ "X-Ops-Server-API-Version" => "2" }) end 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" }) + expect(class_instance.handle_request(method, url, headers, data)[2]) + .to include({ "X-Ops-Server-API-Version" => "-10" }) end end end @@ -98,16 +98,16 @@ describe Chef::HTTP::Authenticator do end context "when ssh_agent_signing" do - let(:public_key) { <<-EOH } ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA49TA0y81ps0zxkOpmf5V -4/c4IeR5yVyQFpX3JpxO4TquwnRh8VSUhrw8kkTLmB3cS39Db+3HadvhoqCEbqPE -6915kXSuk/cWIcNozujLK7tkuPEyYVsyTioQAddSdfe+8EhQVf3oHxaKmUd6waXr -WqYCnhxgOjxocenREYNhZ/OETIeiPbOku47vB4nJK/0GhKBytL2XnsRgfKgDxf42 -BqAi1jglIdeq8lAWZNF9TbNBU21AO1iuT7Pm6LyQujhggPznR5FJhXKRUARXBJZa -wxpGV4dGtdcahwXNE4601aXPra+xPcRd2puCNoEDBzgVuTSsLYeKBDMSfs173W1Q -YwIDAQAB ------END PUBLIC KEY----- + let(:public_key) { <<~EOH } + -----BEGIN PUBLIC KEY----- + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA49TA0y81ps0zxkOpmf5V + 4/c4IeR5yVyQFpX3JpxO4TquwnRh8VSUhrw8kkTLmB3cS39Db+3HadvhoqCEbqPE + 6915kXSuk/cWIcNozujLK7tkuPEyYVsyTioQAddSdfe+8EhQVf3oHxaKmUd6waXr + WqYCnhxgOjxocenREYNhZ/OETIeiPbOku47vB4nJK/0GhKBytL2XnsRgfKgDxf42 + BqAi1jglIdeq8lAWZNF9TbNBU21AO1iuT7Pm6LyQujhggPznR5FJhXKRUARXBJZa + wxpGV4dGtdcahwXNE4601aXPra+xPcRd2puCNoEDBzgVuTSsLYeKBDMSfs173W1Q + YwIDAQAB + -----END PUBLIC KEY----- EOH let(:class_instance) { Chef::HTTP::Authenticator.new(client_name: "test", raw_key: public_key, ssh_agent_signing: true) } diff --git a/spec/unit/http/ssl_policies_spec.rb b/spec/unit/http/ssl_policies_spec.rb index df6dee1198..b67ecc84de 100644 --- a/spec/unit/http/ssl_policies_spec.rb +++ b/spec/unit/http/ssl_policies_spec.rb @@ -145,7 +145,7 @@ describe "HTTP SSL Policy" do # For whatever reason, OpenSSL errors out when adding a # cert you already have to the certificate store. ssl_policy.set_custom_certs - ssl_policy.set_custom_certs #should not raise an error + ssl_policy.set_custom_certs # should not raise an error end end end diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb index 1f24acb94a..673e03f7f4 100644 --- a/spec/unit/http/validate_content_length_spec.rb +++ b/spec/unit/http/validate_content_length_spec.rb @@ -44,7 +44,7 @@ describe Chef::HTTP::ValidateContentLength do end let(:response) do - m = double("HttpResponse", :body => response_body) + m = double("HttpResponse", body: response_body) allow(m).to receive(:[]) do |key| response_headers[key] end @@ -67,7 +67,7 @@ describe Chef::HTTP::ValidateContentLength do data_length = streaming_length while data_length > 0 chunk_size = data_length > 10 ? 10 : data_length - stream_handler.handle_chunk(double("Chunk", :bytesize => chunk_size)) + stream_handler.handle_chunk(double("Chunk", bytesize: chunk_size)) data_length -= chunk_size end |