From 0661771ee6a72adec223a0dfa2fa14eeb530813b Mon Sep 17 00:00:00 2001 From: Yorgos Saslis Date: Sat, 24 Oct 2015 03:29:29 +0300 Subject: Added support for Zypper to install multiple packages at once See #3570 --- spec/unit/provider/package/zypper_spec.rb | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'spec') diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index 0f39fde5cf..4386501837 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -261,4 +261,40 @@ describe Chef::Provider::Package::Zypper do end end end + + describe "when installing multiple packages" do # https://github.com/chef/chef/issues/3570 + it "should install an array of package names and versions" do + allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false) + shell_out_expectation!( + "zypper --non-interactive --no-gpg-checks install "+ + "--auto-agree-with-licenses emacs=1.0 vim=2.0" + ) + provider.install_package(["emacs", "vim"], ["1.0", "2.0"]) + end + + it "should install an array of package names without versions" do + allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false) + shell_out_expectation!( + "zypper --non-interactive --no-gpg-checks install "+ + "--auto-agree-with-licenses emacs vim" + ) + provider.install_package(["emacs", "vim"], nil) + end + + it "should remove an array of package names and versions" do + allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false) + shell_out_expectation!( + "zypper --non-interactive --no-gpg-checks remove emacs=1.0 vim=2.0" + ) + provider.remove_package(["emacs", "vim"], ["1.0", "2.0"]) + end + + it "should remove an array of package names without versions" do + allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false) + shell_out_expectation!( + "zypper --non-interactive --no-gpg-checks remove emacs vim" + ) + provider.remove_package(["emacs", "vim"], nil) + end + end end -- cgit v1.2.1