diff options
author | Manick Vel <mkumaravel@msystechnologies.com> | 2021-10-14 19:27:35 +0530 |
---|---|---|
committer | pratixha <pratiksha.prajapati@msystechnologies.com> | 2022-05-25 12:13:21 +0530 |
commit | 049d64ac75b709ad4b6e0ab3a6b5b824cb1578a3 (patch) | |
tree | 1d3d8e93e13131906c09bbcd6a3d6b8bbc3a42d4 /spec/unit/provider/package | |
parent | 6c9e276fa8c3de273c3bb742be2d64934046bbfb (diff) | |
download | chef-049d64ac75b709ad4b6e0ab3a6b5b824cb1578a3.tar.gz |
Made source addition to zypper package and added specs too
Diffstat (limited to 'spec/unit/provider/package')
-rw-r--r-- | spec/unit/provider/package/zypper_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index a1f6629f55..d77059c180 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -32,6 +32,8 @@ describe Chef::Provider::Package::Zypper do let(:status) { double(stdout: "\n", exitstatus: 0) } + let(:source) { "/tmp/wget_1.11.4-1ubuntu1_amd64.deb" } + before(:each) do allow(Chef::Resource::Package).to receive(:new).and_return(current_resource) allow(provider).to receive(:shell_out_compacted!).and_return(status) @@ -163,6 +165,15 @@ describe Chef::Provider::Package::Zypper do ) provider.install_package(["emacs"], ["1.0"]) end + + it "should run zypper install with source option" do + new_resource.source "/tmp/wget_1.11.4-1ubuntu1_amd64.deb" + allow(::File).to receive(:exist?).with("/tmp/wget_1.11.4-1ubuntu1_amd64.deb").and_return(true) + shell_out_expectation!( + "zypper","--non-interactive", "install", "--auto-agree-with-licenses", "--oldpackage", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb" + ) + provider.install_package(["emacs"], ["1.0"]) + end end describe "upgrade_package" do @@ -200,6 +211,16 @@ describe Chef::Provider::Package::Zypper do ) provider.upgrade_package(["emacs"], ["1.0"]) end + + it "should run zypper upgrade with source option" do + new_resource.source "/tmp/wget_1.11.4-1ubuntu1_amd64.deb" + allow(::File).to receive(:exist?).with("/tmp/wget_1.11.4-1ubuntu1_amd64.deb").and_return(true) + shell_out_expectation!( + "zypper","--non-interactive", "install", "--auto-agree-with-licenses", "--oldpackage", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb" + ) + provider.upgrade_package(["emacs"], ["1.0"]) + end + end describe "remove_package" do |