Skip to content

Commit

Permalink
Added support for Zypper to install multiple packages at once
Browse files Browse the repository at this point in the history
See #3570
  • Loading branch information
Yorgos Saslis authored and lamont-granquist committed Dec 9, 2015
1 parent a3ac2c4 commit 0884c8e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/unit/provider/package/zypper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,40 @@ def shell_out_expectation!(command, options=nil)
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

0 comments on commit 0884c8e

Please sign in to comment.