summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@chef.io>2016-02-29 12:37:24 -0800
committerChris Doherty <cdoherty@chef.io>2016-02-29 12:37:24 -0800
commitb799e17badc3c53a7b531e02f55f5dbac7b3ab4b (patch)
tree1ecce32df75b23dfb8cb7f08bbc91fbc48a1a4db
parent9db6ff8d4f1a4f461ce94303eb9ab5038c302e7e (diff)
downloadchef-b799e17badc3c53a7b531e02f55f5dbac7b3ab4b.tar.gz
Rubocop.
-rw-r--r--chef-config/lib/chef-config/config.rb16
-rw-r--r--chef-config/spec/unit/config_spec.rb3
-rw-r--r--spec/unit/rest/auth_credentials_spec.rb8
3 files changed, 13 insertions, 14 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 1a005fe152..623e8c9d87 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -847,14 +847,14 @@ module ChefConfig
# proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy
# here since we are really just trying to get the string built correctly.
proxy = if !proxy_env_var.empty?
- if proxy_env_var.match(/^.*:\/\//)
- URI.parse(proxy_env_var)
- else
- URI.parse("#{scheme}://#{proxy_env_var}")
- end
- end
-
- excludes = ENV['no_proxy'].to_s.split(/\s*,\s*/).compact
+ if proxy_env_var.match(/^.*:\/\//)
+ URI.parse(proxy_env_var)
+ else
+ URI.parse("#{scheme}://#{proxy_env_var}")
+ end
+ end
+
+ excludes = ENV["no_proxy"].to_s.split(/\s*,\s*/).compact
excludes = excludes.map { |exclude| exclude =~ /:\d+$/ ? exclude : "#{exclude}:*" }
return proxy unless excludes.any? { |exclude| File.fnmatch(exclude, "#{host}:#{port}") }
end
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index e8af94b250..78a4fba69e 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -847,7 +847,7 @@ RSpec.describe ChefConfig::Config do
context "when an empty proxy is set by the environment" do
let(:env) do
{
- "https_proxy" => ""
+ "https_proxy" => "",
}
end
@@ -879,7 +879,6 @@ RSpec.describe ChefConfig::Config do
it { is_expected.to eq nil }
end
-
context "when no_proxy is included on a list" do
let(:env) do
{
diff --git a/spec/unit/rest/auth_credentials_spec.rb b/spec/unit/rest/auth_credentials_spec.rb
index af6fc01aeb..dcc0f923b4 100644
--- a/spec/unit/rest/auth_credentials_spec.rb
+++ b/spec/unit/rest/auth_credentials_spec.rb
@@ -96,13 +96,13 @@ end
describe Chef::REST::RESTRequest do
let(:url) { URI.parse("http://chef.example.com:4000/?q=chef_is_awesome") }
- def new_request(method=nil)
+ def new_request(method = nil)
method ||= :POST
Chef::REST::RESTRequest.new(method, url, @req_body, @headers)
end
before do
- @auth_credentials = Chef::REST::AuthCredentials.new("client-name", CHEF_SPEC_DATA + '/ssl/private_key.pem')
+ @auth_credentials = Chef::REST::AuthCredentials.new("client-name", CHEF_SPEC_DATA + "/ssl/private_key.pem")
@req_body = '{"json_data":"as_a_string"}'
@headers = { "Content-type" => "application/json",
"Accept" => "application/json",
@@ -182,7 +182,7 @@ describe Chef::REST::RESTRequest do
"http_proxy_pass" => nil,
"https_proxy_user" => nil,
"https_proxy_pass" => nil,
- "no_proxy" => nil,
+ "no_proxy" => nil
)
end
@@ -265,7 +265,7 @@ describe Chef::REST::RESTRequest do
describe "with :https_proxy_user and :https_proxy_pass set" do
before do
stub_const("ENV", "http_proxy" => "http://proxy.example.com:3128",
- "https_proxy" => "https://homie:theclown@sproxy.example.com:3129",
+ "https_proxy" => "https://homie:theclown@sproxy.example.com:3129"
)
end