summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorpratixha <pratiksha.prajapati@msystechnologies.com>2022-05-10 17:56:00 +0530
committerpratixha <pratiksha.prajapati@msystechnologies.com>2022-05-25 12:13:25 +0530
commitfa552fab9be9551dbc8f06f98c35a28b21fe7d82 (patch)
tree625444b40f9ffe88313295443e9e2f1c1617d2a1 /spec/unit
parent9e40fb06c3659a8f3c2d53b0fa476fcc6775f66b (diff)
downloadchef-fa552fab9be9551dbc8f06f98c35a28b21fe7d82.tar.gz
Missing source path unit and functional specs
Signed-off-by: pratixha <pratiksha.prajapati@msystechnologies.com>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/package/zypper_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index 95810edcb4..2850a70560 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -174,6 +174,12 @@ describe Chef::Provider::Package::Zypper do
)
provider.install_package(["wget"], ["1.11.4-1ubuntu1_amd64"])
end
+
+ it "should raise an exception if a source is supplied but not found when :install" do
+ new_resource.source "/tmp/blah/wget_1.11.4-1ubuntu1_amd64.rpm"
+ allow(::File).to receive(:exist?).with(new_resource.source).and_return(false)
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
+ end
end
describe "upgrade_package" do
@@ -218,9 +224,14 @@ describe Chef::Provider::Package::Zypper do
shell_out_expectation!(
"zypper", "--non-interactive", "install", "--auto-agree-with-licenses", "--oldpackage", "/tmp/wget_1.11.4-1ubuntu1_amd64.rpm"
)
- provider.install_package(["wget"], ["1.11.4-1ubuntu1_amd64"])
+ provider.upgrade_package(["wget"], ["1.11.4-1ubuntu1_amd64"])
end
+ it "should raise an exception if a source is supplied but not found when :upgrade" do
+ new_resource.source "/tmp/blah/wget_1.11.4-1ubuntu1_amd64.rpm"
+ allow(::File).to receive(:exist?).with(new_resource.source).and_return(false)
+ expect { provider.run_action(:upgrade) }.to raise_error(Chef::Exceptions::Package)
+ end
end
describe "remove_package" do