summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-05-27 13:40:26 -0700
committerClaire McQuin <claire@getchef.com>2014-06-03 09:16:54 -0700
commitb77404a53a50fa699d4358fd92f194223c56e70d (patch)
tree0b54016912314a34c92212c7c3a7b9d24465ffc6
parent2ee87e92abbf710b5ed5d932ed84f9cb804d350c (diff)
downloadchef-b77404a53a50fa699d4358fd92f194223c56e70d.tar.gz
test proxy env vars available for shell_out
-rw-r--r--spec/functional/application_spec.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/functional/application_spec.rb b/spec/functional/application_spec.rb
new file mode 100644
index 0000000000..c6dec12983
--- /dev/null
+++ b/spec/functional/application_spec.rb
@@ -0,0 +1,54 @@
+#
+# Copyright:: Copyright (c) 2014 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require 'spec_helper'
+require 'chef/mixin/shell_out'
+
+describe Chef::Application do
+ include Chef::Mixin::ShellOut
+
+ before do
+ @original_argv = ARGV.dup
+ ARGV.clear
+ @app = Chef::Application.new
+ end
+
+ after do
+ ARGV.replace(@original_argv)
+ end
+
+ describe "when proxy options are set in config" do
+ before do
+ Chef::Config[:http_proxy] = "http://proxy.example.org:8080"
+ Chef::Config[:https_proxy] = nil
+ Chef::Config[:ftp_proxy] = nil
+ Chef::Config[:no_proxy] = nil
+
+ @app.configure_environment_variables
+ end
+
+ it "saves built proxy to ENV which shell_out can use" do
+ so = if windows?
+ shell_out("echo $env:HTTP_PROXY")
+ else
+ shell_out("echo $HTTP_PROXY")
+ end
+
+ so.stdout.should == "http://proxy.example.org:8080\n"
+ end
+ end
+end