summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-06-01 11:04:58 +0100
committerGitHub <noreply@github.com>2018-06-01 11:04:58 +0100
commit52786b7bd9f7b7cdd3cdd9962e64ab104f9e17ec (patch)
treeaae43379ee9c92bfa45b6be36b1a05489f4193f9 /spec
parenta3ced2c6b92d842ea93515337e575fd1f18dad17 (diff)
parentda8dcb98cf650708b6a9d44fa6ef2339e0b0f64c (diff)
downloadchef-52786b7bd9f7b7cdd3cdd9962e64ab104f9e17ec.tar.gz
Merge pull request #7299 from josh-barker/josh-barker/windows-package-missing-source
Check local file exists before installing a windows package
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/package/windows_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index d07e68cb5b..0f4fd465c8 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -394,6 +394,18 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
end
end
+
+ context "a missing local file is given" do
+ let(:resource_source) { "C:/a_missing_file.exe" }
+ let(:installer_type) { nil }
+
+ it "raises a Package error" do
+ allow(::File).to receive(:exist?).with(provider.new_resource.source).and_return(false)
+
+ provider.load_current_resource
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
+ end
+ end
end
shared_context "valid checksum" do