From 379dcfa568ba6acfa247a9b2b2200b2dc571dff1 Mon Sep 17 00:00:00 2001 From: Sam Phippen Date: Sat, 12 Sep 2015 14:31:49 +0100 Subject: [PATCH] Add a failing test for #6065 --- .../provisioners/shell/provisioner_test.rb | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/unit/plugins/provisioners/shell/provisioner_test.rb diff --git a/test/unit/plugins/provisioners/shell/provisioner_test.rb b/test/unit/plugins/provisioners/shell/provisioner_test.rb new file mode 100644 index 000000000..8c9201717 --- /dev/null +++ b/test/unit/plugins/provisioners/shell/provisioner_test.rb @@ -0,0 +1,39 @@ +require File.expand_path("../../../../base", __FILE__) +require Vagrant.source_root.join("plugins/provisioners/shell/provisioner") + +describe "Vagrant::Shell::Provisioner" do + + let(:machine) { + double(:machine).tap { |machine| + machine.stub_chain(:config, :vm, :communicator).and_return(:not_winrm) + machine.stub_chain(:communicate, :tap) {} + } + } + + + context "with a script that contains invalid us-ascii byte sequences" do + let(:config) { + double( + :config, + :args => "doesn't matter", + :upload_path => "arbitrary", + :remote? => false, + :path => nil, + :inline => script_that_is_incorrectly_us_ascii_encoded, + :binary => false, + ) + } + + let(:script_that_is_incorrectly_us_ascii_encoded) { + [207].pack("c*").force_encoding("US-ASCII") + } + + it "does not raise an exception when normalizing newlines" do + vsp = VagrantPlugins::Shell::Provisioner.new(machine, config) + + expect { + vsp.provision + }.not_to raise_error + end + end +end