From b912d1075286261b0e9523cecff1997b59034b75 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Wed, 24 Feb 2016 20:27:56 -0800 Subject: ensure paths maintain utf-8ness in non ascii encodings --- spec/unit/mixin/path_sanity_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec') diff --git a/spec/unit/mixin/path_sanity_spec.rb b/spec/unit/mixin/path_sanity_spec.rb index e410f034d5..2c26e2fb79 100644 --- a/spec/unit/mixin/path_sanity_spec.rb +++ b/spec/unit/mixin/path_sanity_spec.rb @@ -56,6 +56,12 @@ describe Chef::Mixin::PathSanity do expect(env["PATH"]).to eq("/usr/bin:/sbin:/bin:#{@ruby_bindir}:#{@gem_bindir}:/usr/local/sbin:/usr/local/bin:/usr/sbin") end + it "creates path with utf-8 encoding" do + env = { "PATH" => "/usr/bin:/sbin:/bin:/b\x81t".force_encoding("ISO-8859-1") } + @sanity.enforce_path_sanity(env) + expect(env["PATH"].encoding.to_s).to eq("UTF-8") + end + it "adds the current executing Ruby's bindir and Gem bindir to the PATH" do env = { "PATH" => "" } @sanity.enforce_path_sanity(env) -- cgit v1.2.1