summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-04-26 21:46:56 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-26 21:46:56 -0700
commit062071871721c0c9cacb7343443fcedf5c378549 (patch)
tree5a44cc651a01c412d5ea4c7e4fe3561fc6c6d3a0
parentdaf65da4090a837b4d283c4153fc2a631e4f0f45 (diff)
downloadchef-062071871721c0c9cacb7343443fcedf5c378549.tar.gz
Add error! spec
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/unit/mixin/powershell_exec_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/mixin/powershell_exec_spec.rb b/spec/unit/mixin/powershell_exec_spec.rb
index bf2285175b..a6d7374f0f 100644
--- a/spec/unit/mixin/powershell_exec_spec.rb
+++ b/spec/unit/mixin/powershell_exec_spec.rb
@@ -40,4 +40,14 @@ describe Chef::Mixin::PowershellExec, :windows_only do
expect(execution.errors[0]).to include("Runtime exception: this-should-error")
end
end
+
+ describe "#powershell_exec!" do
+ it "runs a basic command and returns a Chef::PowerShell object" do
+ expect(object.powershell_exec("$PSVersionTable")).to be_kind_of(Chef::PowerShell::CommandFailed
+ end
+
+ it "raises an error if the command fails" do
+ expect { object.powershell_exec("$PSVersionTable") }.to raise_error(Chef::Exceptions::Script)
+ end
+ end
end