diff options
author | Nimesh-Msys <nimesh.patni@msystechnologies.com> | 2019-01-29 16:04:02 +0530 |
---|---|---|
committer | Nimesh-Msys <nimesh.patni@msystechnologies.com> | 2019-02-04 11:50:25 +0530 |
commit | 13fd78e7b6523d8f172c2173ae8153168c319ff6 (patch) | |
tree | 478070373f832253075f9922533436542ebacd7a /spec/functional/resource/powershell_script_spec.rb | |
parent | cdb329bb9ff22f84c445410e1fc819c04bd94699 (diff) | |
download | chef-13fd78e7b6523d8f172c2173ae8153168c319ff6.tar.gz |
As per the review comments
- Using `flags` attribute from resources itself
- Fixed and add the required test cases
Signed-off-by: Nimesh-Msys <nimesh.patni@msystechnologies.com>
Diffstat (limited to 'spec/functional/resource/powershell_script_spec.rb')
-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 } |