diff options
-rw-r--r-- | lib/chef/http/json_input.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/env/windows.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/windows.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/group_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/powershell_script_spec.rb | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/http/json_input.rb b/lib/chef/http/json_input.rb index eaee96d88a..4cc1aa2e10 100644 --- a/lib/chef/http/json_input.rb +++ b/lib/chef/http/json_input.rb @@ -33,7 +33,7 @@ class Chef def handle_request(method, url, headers = {}, data = false) if data && should_encode_as_json?(headers) - headers.delete_if { |key, _value| key.downcase == "content-type" } + headers.delete_if { |key, _value| key.casecmp("content-type").zero? } headers["Content-Type"] = "application/json" json_opts = {} json_opts[:validate_utf8] = opts[:validate_utf8] if opts.has_key?(:validate_utf8) @@ -64,7 +64,7 @@ class Chef # ruby/Net::HTTP don't enforce capitalized headers (it normalizes them # for you before sending the request), so we have to account for all # the variations we might find - requested_content_type = headers.find { |k, v| k.downcase == "content-type" } + requested_content_type = headers.find { |k, v| k.casecmp("content-type").zero? } requested_content_type.nil? || requested_content_type.last.include?("json") end diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index a27a3b332b..356bf47fd4 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -145,7 +145,7 @@ class Chef end def self.subcommand_class_from(args) - if args.size == 1 && args[0].strip.downcase == "rehash" + if args.size == 1 && args[0].strip.casecmp("rehash").zero? # To prevent issues with the rehash file not pointing to the correct plugins, # we always use the glob loader when regenerating the rehash file @subcommand_loader = Chef::Knife::SubcommandLoader.gem_glob_loader(chef_config_dir) diff --git a/lib/chef/provider/env/windows.rb b/lib/chef/provider/env/windows.rb index 684386abe4..a68c8276e0 100644 --- a/lib/chef/provider/env/windows.rb +++ b/lib/chef/provider/env/windows.rb @@ -36,7 +36,7 @@ class Chef obj.variablevalue = @new_resource.value obj.put_ value = @new_resource.value - value = expand_path(value) if @new_resource.key_name.upcase == "PATH" + value = expand_path(value) if @new_resource.key_name.casecmp("PATH").zero? ENV[@new_resource.key_name] = value broadcast_env_change end diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb index 02137a5525..a5f3ff7191 100644 --- a/lib/chef/provider/package/windows.rb +++ b/lib/chef/provider/package/windows.rb @@ -260,7 +260,7 @@ class Chef if source_location.nil? inferred_registry_type == :msi else - ::File.extname(source_location).downcase == ".msi" + ::File.extname(source_location).casecmp(".msi").zero? end end end diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb index f7c232b588..cd899ea97a 100644 --- a/spec/functional/resource/group_spec.rb +++ b/spec/functional/resource/group_spec.rb @@ -81,7 +81,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte if user && domain != "." computer_name = ENV["computername"] - domain.downcase != computer_name.downcase + !domain.casecmp(computer_name.downcase).zero? end end diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb index c44c445fd8..5b5c783986 100644 --- a/spec/unit/provider/powershell_script_spec.rb +++ b/spec/unit/provider/powershell_script_spec.rb @@ -74,7 +74,7 @@ describe Chef::Provider::PowershellScript, "action_run" do provider_flags.find do |value| execution_policy_index += 1 - execution_policy_specified = value.downcase == "-ExecutionPolicy".downcase + execution_policy_specified = value.casecmp("-ExecutionPolicy".downcase).zero? end execution_policy = execution_policy_specified ? provider_flags[execution_policy_index] : nil |