diff options
author | Tim Smith <tsmith@chef.io> | 2019-02-05 15:50:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-05 15:50:49 -0800 |
commit | fd764dff9f1cdaa1970aa4b10e8890a656175939 (patch) | |
tree | 1a89944e45ad77013acf31d89774ec739e233f5b /spec/functional | |
parent | 7d8c3ba4b8aac21f7049ceed5a014e4cb556a6a4 (diff) | |
parent | 13fd78e7b6523d8f172c2173ae8153168c319ff6 (diff) | |
download | chef-fd764dff9f1cdaa1970aa4b10e8890a656175939.tar.gz |
Merge pull request #8167 from MsysTechnologiesllc/nimesh/MSYS-960_set_psscript_flags
powershell_script: Prefer user provided flags over the defaults
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/resource/powershell_script_spec.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb index e4c96976d9..850c273a6c 100644 --- a/spec/functional/resource/powershell_script_spec.rb +++ b/spec/functional/resource/powershell_script_spec.rb @@ -231,22 +231,28 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do expect(is_64_bit).to eq(detected_64_bit) end - it "returns 1 if an invalid flag is passed to the interpreter" do - pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server? - + it "returns 0 if a valid flag is passed to the interpreter" do resource.code(cmdlet_exit_code_success_content) - resource.flags(invalid_powershell_interpreter_flag) - resource.returns(1) + resource.flags(valid_powershell_interpreter_flag) + resource.returns(0) resource.run_action(:run) end - it "returns 0 if a valid flag is passed to the interpreter" do + it "returns 0 if no flag is passed to the interpreter" do resource.code(cmdlet_exit_code_success_content) - resource.flags(valid_powershell_interpreter_flag) resource.returns(0) resource.run_action(:run) end + it "returns 1 if an invalid flag is passed to the interpreter" do + pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server? + + resource.code(cmdlet_exit_code_success_content) + resource.flags(invalid_powershell_interpreter_flag) + resource.returns(1) + expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed) + end + it "raises an error when given a block and a guard_interpreter" do resource.guard_interpreter :sh resource.only_if { true } |