summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-05-11 11:06:35 -0700
committerTim Smith <tsmith@chef.io>2018-08-13 11:09:23 -0700
commit12a28933b46b83e6745a873d174a1fbe9e46f13d (patch)
tree20f48f3601337ee47aa12ad195a814d96b2c2ae2 /spec
parent968f503119b8df8a23ab1c993024238a4759fdd6 (diff)
downloadchef-12a28933b46b83e6745a873d174a1fbe9e46f13d.tar.gz
Add cron_d and cron_access resources from the cron cookbook
Cron_d was the #1 requested resource that we already had written. Everyone uses it and we should ship it. It's not a replacement for the existing cron cookbook, but just a different way of managing cron. If people want to manage the whole file or individual snippets we'll give them the option, just as we've always done by having the core resource and this resource. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/cron_access_spec.rb32
-rw-r--r--spec/unit/resource/cron_d_spec.rb32
2 files changed, 64 insertions, 0 deletions
diff --git a/spec/unit/resource/cron_access_spec.rb b/spec/unit/resource/cron_access_spec.rb
new file mode 100644
index 0000000000..1fd16f315f
--- /dev/null
+++ b/spec/unit/resource/cron_access_spec.rb
@@ -0,0 +1,32 @@
+#
+# Copyright:: Copyright 2018, Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+
+describe Chef::Resource::CronAccess do
+ let(:resource) { Chef::Resource::CronAccess.new("bob") }
+
+ it "has a default action of [:deny]" do
+ expect(resource.action).to eql([:deny])
+ end
+
+ it "accepts create or delete for action" do
+ expect { resource.action :allow }.not_to raise_error
+ expect { resource.action :deny }.not_to raise_error
+ expect { resource.action :lolcat }.to raise_error(ArgumentError)
+ end
+end
diff --git a/spec/unit/resource/cron_d_spec.rb b/spec/unit/resource/cron_d_spec.rb
new file mode 100644
index 0000000000..99899131f8
--- /dev/null
+++ b/spec/unit/resource/cron_d_spec.rb
@@ -0,0 +1,32 @@
+#
+# Copyright:: Copyright 2018, Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+
+describe Chef::Resource::CronD do
+ let(:resource) { Chef::Resource::CronD.new("cronify") }
+
+ it "has a default action of [:create]" do
+ expect(resource.action).to eql([:create])
+ end
+
+ it "accepts create or delete for action" do
+ expect { resource.action :create }.not_to raise_error
+ expect { resource.action :delete }.not_to raise_error
+ expect { resource.action :lolcat }.to raise_error(ArgumentError)
+ end
+end