diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-30 14:31:15 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-30 14:31:15 -0700 |
commit | d9924be2a17e2592c58655830d4e9038db27d887 (patch) | |
tree | 324508b11fd834143f5e0ddd1fa24aef1507c669 /spec/functional | |
parent | c80702c741232a5da0d410d4b8770137690430aa (diff) | |
download | chef-d9924be2a17e2592c58655830d4e9038db27d887.tar.gz |
convert shell_out_with_systems_locale to `default_env: true`lcg/remove-shell-out-with-systems-locale
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/mixin/shell_out_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
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 |