diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-03 09:36:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-03 09:42:19 -0700 |
commit | 128e9dcb62015c2612e2d397d26f2dd334bcc843 (patch) | |
tree | 3a0843580725c85920c0f52d95980dad068aeb55 /spec/unit | |
parent | 6837d6bda9fbfdcab0c2d26f3313ec106137e203 (diff) | |
download | chef-128e9dcb62015c2612e2d397d26f2dd334bcc843.tar.gz |
fix data collector non-utf8 file output
forces output to UTF-8 so it doesn't throw.
closes #8326
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/data_collector_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/data_collector_spec.rb b/spec/unit/data_collector_spec.rb index 154ab4681c..fed0e54b45 100644 --- a/spec/unit/data_collector_spec.rb +++ b/spec/unit/data_collector_spec.rb @@ -871,4 +871,12 @@ describe Chef::DataCollector do end end + + describe "#send_to_file_location(file_name, message)" do + let(:tempfile) { Tempfile.new("rspec-chef-datacollector-out") } + let(:shift_jis) { "I have no idea what this character is:\n #{0x83.chr}#{0x80.chr}.\n" } + it "handles invalid UTF-8 properly" do + data_collector.send(:send_to_file_location, tempfile, { invalid: shift_jis }) + end + end end |