summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgscho <greg.c.schofield@gmail.com>2021-07-08 12:29:35 -0400
committerJohn McCrae <john.mccrae@progress.com>2021-07-16 15:38:13 -0700
commite85e9afc74dcd1fc75c424e8424598e1c4bc5aa2 (patch)
tree20f1ce2f663f75478e09ea4eeeffc89b86638357
parentcea2aee83e3fd17f1369be4aad80e23ec2fdd1c6 (diff)
downloadchef-e85e9afc74dcd1fc75c424e8424598e1c4bc5aa2.tar.gz
Pass new_resource.version as nil and expect stubbed version
Signed-off-by: gscho <greg.c.schofield@gmail.com>
-rw-r--r--spec/unit/provider/package/powershell_spec.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/unit/provider/package/powershell_spec.rb b/spec/unit/provider/package/powershell_spec.rb
index e670a1d52b..8bf95b9b14 100644
--- a/spec/unit/provider/package/powershell_spec.rb
+++ b/spec/unit/provider/package/powershell_spec.rb
@@ -475,11 +475,12 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
it "should install a package using provided options" do
provider.load_current_resource
new_resource.package_name(["xCertificate"])
+ new_resource.version(nil)
new_resource.options(%w{-AcceptLicense -Verbose})
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("#{tls_set_command} ( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -AcceptLicense -Verbose ).Version", { timeout: new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("#{tls_set_command} ( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -AcceptLicense -Verbose ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end