diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-14 10:06:38 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-23 12:24:37 -0700 |
commit | efa9807bbcb592fcaf2ad559e1d7982f9cac147f (patch) | |
tree | 6d93b425cee6f02c61a917aacc4de6c145c1d62a /spec | |
parent | b8d6fac0280d165aee24c40e171d921fb10deb63 (diff) | |
download | chef-efa9807bbcb592fcaf2ad559e1d7982f9cac147f.tar.gz |
Add swap_file resource form the swap cookbook
Copied as-is from the cookbook
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/resource/swap_file_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/unit/resource/swap_file_spec.rb b/spec/unit/resource/swap_file_spec.rb new file mode 100644 index 0000000000..905e12646a --- /dev/null +++ b/spec/unit/resource/swap_file_spec.rb @@ -0,0 +1,40 @@ +# +# 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::SwapFile do + let(:resource) { Chef::Resource::SwapFile.new("swapfile") } + + it "sets resource name as :swap_file" do + expect(resource.resource_name).to eql(:swap_file) + end + + it "sets the path as its name" do + expect(resource.path).to eql("swapfile") + end + + it "sets the default action as :create" do + expect(resource.action).to eql([:create]) + end + + it "supports :create and :remove actions" do + expect { resource.action :create }.not_to raise_error + expect { resource.action :remove }.not_to raise_error + expect { resource.action :delete }.to raise_error(ArgumentError) + end +end |