From d9924be2a17e2592c58655830d4e9038db27d887 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 30 May 2018 14:31:15 -0700 Subject: convert shell_out_with_systems_locale to `default_env: true` Signed-off-by: Lamont Granquist --- spec/functional/mixin/shell_out_spec.rb | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'spec/functional') diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb index 48f6b7d912..f0d1eb7cbc 100644 --- a/spec/functional/mixin/shell_out_spec.rb +++ b/spec/functional/mixin/shell_out_spec.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2014-2016, Chef Software, Inc. +# Copyright:: Copyright 2014-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,4 +45,30 @@ describe Chef::Mixin::ShellOut do end end end + + describe "shell_out default_env: false" do + describe "when environment['LC_ALL'] is not set" do + it "should use the default shell_out setting" do + cmd = if windows? + shell_out("echo %LC_ALL%", default_env: false) + else + shell_out("echo $LC_ALL", default_env: false) + end + + expect(cmd.stdout.chomp).to match_environment_variable("LC_ALL") + end + end + + describe "when environment['LC_ALL'] is set" do + it "should use the option's setting" do + cmd = if windows? + shell_out("echo %LC_ALL%", :environment => { "LC_ALL" => "POSIX" }, default_env: false) + else + shell_out("echo $LC_ALL", :environment => { "LC_ALL" => "POSIX" }, default_env: false) + end + + expect(cmd.stdout.chomp).to eq "POSIX" + end + end + end end -- cgit v1.2.1