diff options
author | snehaldwivedi <sdwivedi@msystechnologies.com> | 2020-07-10 16:12:32 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-15 12:35:31 -0700 |
commit | 0da8beaf4f4545acfea11b168c4b2134c3aa321d (patch) | |
tree | 23336c53b997ca2934e9b8b7719ebd68e83ebd79 /spec | |
parent | 036dc1354b031b32527d952f283f00e60ee998f4 (diff) | |
download | chef-0da8beaf4f4545acfea11b168c4b2134c3aa321d.tar.gz |
Fix windows package tests.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/package/windows_spec.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index c327e4217b..c7f277fe76 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -70,16 +70,18 @@ describe Chef::Provider::Package::Windows, :windows_only do end end - context "when the source is a uri" do - let(:resource_source) { "https://foo.bar/calculator.msi" } - - context "when the source has not been downloaded" do + context "when the source is not present it loads from cache" do + context "when the package is not installed" do before(:each) do - allow(provider).to receive(:downloadable_file_missing?).and_return(true) + allow(provider).to receive(:uri_scheme?).and_return(false) + allow(provider.package_provider).to receive(:get_product_property).and_return(nil) + allow(provider.package_provider).to receive(:get_installed_version).and_return(nil) + allow(provider.package_provider).to receive(:package_version).and_return(nil) end - it "sets the current version to unknown" do + + it "sets the current version nil" do provider.load_current_resource - expect(provider.current_resource.version).to eql("unknown") + expect(provider.current_resource.version).to eql(nil) end end @@ -312,7 +314,10 @@ describe Chef::Provider::Package::Windows, :windows_only do let(:resource_source) { "https://foo.bar/calculator.exe" } it "downloads the http resource" do - allow(File).to receive(:exist?).with('c:\cache\calculator.exe').and_return(false) + allow(provider).to receive(:uri_scheme?).and_return(true) + allow(provider).to receive(:installer_type).and_return(nil) + allow(File).to receive(:exist?).with("https\\foo.bar\\calculator.exe").and_return(false) + allow(provider).to receive(:compile_and_converge_action) expect(provider).to receive(:download_source_file) provider.run_action(:install) end |