summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package/zypper_spec.rb
diff options
context:
space:
mode:
authorJulian C. Dunn <jdunn@getchef.com>2014-08-03 21:36:33 -0400
committerJulian C. Dunn <jdunn@getchef.com>2014-08-03 21:37:30 -0400
commitfd6b23e91244b0d2b9adfd33fa48d266f56914c3 (patch)
treea978ec84f39cca9e9b602009489a33c377accbab /spec/unit/provider/package/zypper_spec.rb
parentca6107a28d675e9d09626958d58e344d969e7e86 (diff)
downloadchef-fd6b23e91244b0d2b9adfd33fa48d266f56914c3.tar.gz
Add unit test for #1174
Diffstat (limited to 'spec/unit/provider/package/zypper_spec.rb')
-rw-r--r--spec/unit/provider/package/zypper_spec.rb44
1 files changed, 28 insertions, 16 deletions
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index c437631309..87f02d7794 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -146,25 +146,37 @@ describe Chef::Provider::Package::Zypper do
end
describe "remove_package" do
- it "should run zypper remove with the package name" do
- Chef::Config.stub(:[]).with(:zypper_check_gpg).and_return(true)
- @provider.should_receive(:shell_out!).with(
- "zypper --non-interactive remove emacs=1.0")
- @provider.remove_package("emacs", "1.0")
+
+ context "when package version is not explicitly specified" do
+ it "should run zypper remove with the package name" do
+ Chef::Config.stub(:[]).with(:zypper_check_gpg).and_return(true)
+ @provider.should_receive(:shell_out!).with(
+ "zypper --non-interactive remove emacs")
+ @provider.remove_package("emacs", nil)
+ end
end
- it "should run zypper remove without gpg checks" do
- Chef::Config.stub(:[]).with(:zypper_check_gpg).and_return(false)
- @provider.should_receive(:shell_out!).with(
+
+ context "when package version is explicitly specified" do
+ it "should run zypper remove with the package name" do
+ Chef::Config.stub(:[]).with(:zypper_check_gpg).and_return(true)
+ @provider.should_receive(:shell_out!).with(
+ "zypper --non-interactive remove emacs=1.0")
+ @provider.remove_package("emacs", "1.0")
+ end
+ it "should run zypper remove without gpg checks" do
+ Chef::Config.stub(:[]).with(:zypper_check_gpg).and_return(false)
+ @provider.should_receive(:shell_out!).with(
+ "zypper --non-interactive --no-gpg-checks remove emacs=1.0")
+ @provider.remove_package("emacs", "1.0")
+ end
+ it "should warn about gpg checks on zypper remove" do
+ Chef::Log.should_receive(:warn).with(
+ /All packages will be installed without gpg signature checks/)
+ @provider.should_receive(:shell_out!).with(
"zypper --non-interactive --no-gpg-checks remove emacs=1.0")
- @provider.remove_package("emacs", "1.0")
- end
- it "should warn about gpg checks on zypper remove" do
- Chef::Log.should_receive(:warn).with(
- /All packages will be installed without gpg signature checks/)
- @provider.should_receive(:shell_out!).with(
- "zypper --non-interactive --no-gpg-checks remove emacs=1.0")
- @provider.remove_package("emacs", "1.0")
+ @provider.remove_package("emacs", "1.0")
+ end
end
end