diff options
author | Matt Wrock <matt@mattwrock.com> | 2015-12-15 12:13:31 -0800 |
---|---|---|
committer | Matt Wrock <matt@mattwrock.com> | 2015-12-15 12:28:53 -0800 |
commit | 09df8eea8bdbca4b7f1f0db43033d8d473860131 (patch) | |
tree | fc01ea00bfc3a6467a59f6ed1e67a6f9ae7496fe /spec | |
parent | b743fcdbd172862386d172b42bbbc31cfe2f4239 (diff) | |
download | chef-09df8eea8bdbca4b7f1f0db43033d8d473860131.tar.gz |
non msi packages must explicitly provide a source attribute on install
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/package/windows_spec.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index c26c446b5b..2c578b1b40 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -280,15 +280,25 @@ describe Chef::Provider::Package::Windows, :windows_only do end describe "action_install" do - let(:new_resource) { Chef::Resource::WindowsPackage.new("blah.exe") } + let(:resource_name) { "blah" } + let(:resource_source) { "blah.exe" } + before do new_resource.installer_type(:inno) allow_any_instance_of(Chef::Provider::Package::Windows::Exe).to receive(:package_version).and_return(new_resource.version) end + context "no source given" do + let(:resource_source) { nil } + + it "raises a NoWindowsPackageSource error" do + expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::NoWindowsPackageSource) + end + end + context "no version given, discovered or installed" do it "installs latest" do - expect(provider).to receive(:install_package).with("blah.exe", "latest") + expect(provider).to receive(:install_package).with("blah", "latest") provider.run_action(:install) end end @@ -306,7 +316,7 @@ describe Chef::Provider::Package::Windows, :windows_only do before { new_resource.version('5.5.5') } it "installs given version" do - expect(provider).to receive(:install_package).with("blah.exe", "5.5.5") + expect(provider).to receive(:install_package).with("blah", "5.5.5") provider.run_action(:install) end end @@ -331,7 +341,7 @@ describe Chef::Provider::Package::Windows, :windows_only do end it "installs given version" do - expect(provider).to receive(:install_package).with("blah.exe", "5.5.5") + expect(provider).to receive(:install_package).with("blah", "5.5.5") provider.run_action(:install) end end @@ -357,7 +367,7 @@ describe Chef::Provider::Package::Windows, :windows_only do end it "installs given version" do - expect(provider).to receive(:install_package).with("blah.exe", "5.5.5") + expect(provider).to receive(:install_package).with("blah", "5.5.5") provider.run_action(:install) end end |