diff options
author | Thom May <thom@may.lt> | 2018-06-01 11:04:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 11:04:58 +0100 |
commit | 52786b7bd9f7b7cdd3cdd9962e64ab104f9e17ec (patch) | |
tree | aae43379ee9c92bfa45b6be36b1a05489f4193f9 /spec | |
parent | a3ced2c6b92d842ea93515337e575fd1f18dad17 (diff) | |
parent | da8dcb98cf650708b6a9d44fa6ef2339e0b0f64c (diff) | |
download | chef-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.rb | 12 |
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 |