From dfb7a0f63f507daabe6fac8d96c85206558b754d Mon Sep 17 00:00:00 2001 From: Adam Edwards Date: Sat, 14 Mar 2015 07:37:32 -0700 Subject: powershell_script spec for invalid syntax error handling --- spec/functional/resource/powershell_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/functional/resource/powershell_spec.rb b/spec/functional/resource/powershell_spec.rb index 56a905efe7..7adff0da05 100644 --- a/spec/functional/resource/powershell_spec.rb +++ b/spec/functional/resource/powershell_spec.rb @@ -102,6 +102,12 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do resource.run_action(:run) end + it "returns 1 if the script provided to the code attribute is not syntactically correct" do + resource.code('if({)') + resource.returns(1) + resource.run_action(:run) + end + # This somewhat ambiguous case, two failures of different types, # seems to violate the principle of returning the status of the # last line executed -- in this case, we return the status of the -- cgit v1.2.1