summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-10-06 12:44:48 -0700
committerClaire McQuin <claire@getchef.com>2015-10-06 13:19:28 -0700
commit9b57fbf80828747699695119a354f51dbb7fa4b2 (patch)
tree32c5d2f3317c6cabaa1338ba9dabcbf6d3119fa4 /spec/support
parent0053c17bba34090083a34395657ff1ba1616e213 (diff)
downloadchef-9b57fbf80828747699695119a354f51dbb7fa4b2.tar.gz
Quote paths.mcquin/chef-3883
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/functional/windows_script.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 70fb2d8578..d84c06c86b 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -128,7 +128,28 @@ shared_context Chef::Resource::WindowsScript do
describe "when the run action is invoked on Windows" do
it "executes the script code" do
- resource.code("whoami > #{script_output_path}")
+ resource.code("whoami > \"#{script_output_path}\"")
+ resource.returns(0)
+ resource.run_action(:run)
+ end
+ end
+
+ context "when $env:TMP has a space" do
+ before(:each) do
+ @dir = Dir.mktmpdir("Jerry Smith")
+ @original_env = ENV.to_hash.dup
+ ENV.delete('TMP')
+ ENV['TMP'] = @dir
+ end
+
+ after(:each) do
+ FileUtils.remove_entry_secure(@dir)
+ ENV.clear
+ ENV.update(@original_env)
+ end
+
+ it "executes the script code" do
+ resource.code("whoami > \"#{script_output_path}\"")
resource.returns(0)
resource.run_action(:run)
end