summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-09-27 14:29:33 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-09-27 14:29:33 -0700
commit271042fadd0319b9246f0f4a85f6a0712ae125ee (patch)
treedeea42eed6dfaf91e976d30c2859f0a38b5f042e
parent6730219d021996d427687b1df8c4fda8c2542349 (diff)
downloadchef-271042fadd0319b9246f0f4a85f6a0712ae125ee.tar.gz
fix package provider superclass specslcg/allow-downgrade-pseudo-default
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/unit/provider/package_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb
index 688d70d677..c46e032757 100644
--- a/spec/unit/provider/package_spec.rb
+++ b/spec/unit/provider/package_spec.rb
@@ -171,7 +171,7 @@ describe Chef::Provider::Package do
it "should print the word 'uninstalled' if there was no original version" do
allow(current_resource).to receive(:version).and_return(nil)
- expect(logger).to receive(:info).with("package[install emacs] upgraded emacs to 1.0")
+ expect(logger).to receive(:info).with("package[install emacs] upgraded(allow_downgrade) emacs to 1.0")
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -714,7 +714,15 @@ describe "Chef::Provider::Package - Multi" do
expect(new_resource).not_to be_updated_by_last_action
end
- it "does not install older version" do
+ it "does install an older version by default" do
+ current_resource.version(["1.1", "6.2"])
+ new_resource.version(["1.0", "6.1"])
+ provider.run_action(:install)
+ expect(new_resource).to be_updated_by_last_action
+ end
+
+ it "does not install an older version if the resource subclass has allow_downgrade set to false" do
+ allow(new_resource).to receive(:allow_downgrade).and_return(false)
current_resource.version(["1.1", "6.2"])
new_resource.version(["1.0", "6.1"])
provider.run_action(:install)