summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAllan Espinosa <aespinosa33@bloomberg.net>2017-12-15 16:13:11 -0500
committerAllan Espinosa <aespinosa33@bloomberg.net>2017-12-20 09:30:56 -0500
commit8014cf573c48e1e7f08d85c0420666443d6da2f8 (patch)
tree737033b0dc7d8440730ae39d0abbf8484918a62d /spec
parentc908db8ed1e3989e9fb81d22fda206839975a0f6 (diff)
downloadchef-8014cf573c48e1e7f08d85c0420666443d6da2f8.tar.gz
Escape single-quoted strings from the context
Fixes #6680 Signed-off-by: Allan Espinosa <aespinosa33@bloomberg.net>
Diffstat (limited to 'spec')
-rw-r--r--spec/data/client.d_00/02-strings.rb2
-rw-r--r--spec/unit/knife/bootstrap_spec.rb5
2 files changed, 7 insertions, 0 deletions
diff --git a/spec/data/client.d_00/02-strings.rb b/spec/data/client.d_00/02-strings.rb
new file mode 100644
index 0000000000..7d9a49268c
--- /dev/null
+++ b/spec/data/client.d_00/02-strings.rb
@@ -0,0 +1,2 @@
+# 02-strings.rb
+something '/foo/bar'
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 736ff9b099..c725526de7 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -516,6 +516,11 @@ describe Chef::Knife::Bootstrap do
end
context "a flat directory structure" do
+ it "escapes single-quotes" do
+ expect(rendered_template).to match("cat > /etc/chef/client.d/02-strings.rb <<'EOP'")
+ expect(rendered_template).to match("something '\\\\''/foo/bar'\\\\''")
+ end
+
it "creates a file 00-foo.rb" do
expect(rendered_template).to match("cat > /etc/chef/client.d/00-foo.rb <<'EOP'")
expect(rendered_template).to match("d6f9b976-289c-4149-baf7-81e6ffecf228")