diff options
author | Tim Smith <tsmith@chef.io> | 2020-08-26 15:02:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 15:02:46 -0700 |
commit | 3cca65b641a4dab175e23d0e505a4032caa740a4 (patch) | |
tree | 0e9c4f53b339fe4637b56bad21fdfaf6cd7083a4 /spec/unit/resource | |
parent | d3f88ab5ebdc7d053f9710334bb8245507452262 (diff) | |
parent | 23b03189365fb612f628c9bd2a6d4000bf9d2e78 (diff) | |
download | chef-3cca65b641a4dab175e23d0e505a4032caa740a4.tar.gz |
Merge pull request #10357 from chef/better_launchd_properties
Improve input handling and validation in chef_client_launchd
Diffstat (limited to 'spec/unit/resource')
-rw-r--r-- | spec/unit/resource/chef_client_launchd_spec.rb (renamed from spec/unit/resource/chef_client_launchd.rb) | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/resource/chef_client_launchd.rb b/spec/unit/resource/chef_client_launchd_spec.rb index 6ec7889c79..4d07471ed5 100644 --- a/spec/unit/resource/chef_client_launchd.rb +++ b/spec/unit/resource/chef_client_launchd_spec.rb @@ -38,6 +38,28 @@ describe Chef::Resource::ChefClientLaunchd do expect { resource.action :disable }.not_to raise_error end + it "raises an error if interval is not a positive number" do + expect { resource.interval("-10") }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "coerces interval to an Integer" do + resource.interval "10" + expect(resource.interval).to eql(10) + 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 + + it "coerces nice to an Integer" do + resource.nice "10" + expect(resource.nice).to eql(10) + end + describe "#all_daemon_options" do it "returns log and config flags if by default" do expect(provider.all_daemon_options).to eql( |