summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorgos Saslis <g.saslis@gmail.com>2015-10-24 03:29:29 +0300
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-25 10:59:50 -0800
commit0661771ee6a72adec223a0dfa2fa14eeb530813b (patch)
tree402a496540d2b4e100ee4979d0d0fa5bcc0c82d8
parent1cb9cc67b71d21d1207602d1ec50ad2d68486171 (diff)
downloadchef-0661771ee6a72adec223a0dfa2fa14eeb530813b.tar.gz
Added support for Zypper to install multiple packages at once
See #3570
-rw-r--r--spec/unit/provider/package/zypper_spec.rb36
1 files changed, 36 insertions, 0 deletions
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