summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-26 14:40:15 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-26 14:40:15 -0700
commit92001258bd817b532b915ac53ac16f4762bd643e (patch)
tree583a0a14641bcebf777124611081c89ffb9fc974 /spec
parentff8a59dab5091968171c69297c315a6943ea28ed (diff)
downloadchef-92001258bd817b532b915ac53ac16f4762bd643e.tar.gz
Validate nice values in the launchd resource
Make sure people give us proper nice values. Also the upper value is 19 not 20. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/launchd_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/resource/launchd_spec.rb b/spec/unit/resource/launchd_spec.rb
index bf3fd39952..62f5ad0b92 100644
--- a/spec/unit/resource/launchd_spec.rb
+++ b/spec/unit/resource/launchd_spec.rb
@@ -37,4 +37,12 @@ describe Chef::Resource::Launchd do
expect { resource.action :enable }.not_to raise_error
expect { resource.action :restart }.not_to raise_error
end
+
+ it "raises an error if nice is less than -20" do
+ expect { resource.nice(-21) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ end
+
+ it "raises an error if nice is greater than 19" do
+ expect { resource.nice(20) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ end
end