summaryrefslogtreecommitdiff
path: root/spec/unit/resource/cookbook_file_spec.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-05-16 12:48:05 -0700
committerTim Smith <tsmith@chef.io>2018-05-16 15:45:33 -0700
commit69687a927da48b169262e3b961fd2c12e6723574 (patch)
treea0744c8401a4ae32ed489c65a3cfd57d3b784b67 /spec/unit/resource/cookbook_file_spec.rb
parentb69877bb0f1b2aec99f9c0a392d064e2b0d21bda (diff)
downloadchef-69687a927da48b169262e3b961fd2c12e6723574.tar.gz
Add additional resource specs
Auto generated from the resource inspector Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/unit/resource/cookbook_file_spec.rb')
-rw-r--r--spec/unit/resource/cookbook_file_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/resource/cookbook_file_spec.rb b/spec/unit/resource/cookbook_file_spec.rb
index c6fdab3a1f..734fc152c1 100644
--- a/spec/unit/resource/cookbook_file_spec.rb
+++ b/spec/unit/resource/cookbook_file_spec.rb
@@ -22,12 +22,23 @@ require "spec_helper"
describe Chef::Resource::CookbookFile do
let(:resource) { Chef::Resource::CookbookFile.new("/foo/bar/sourcecode_tarball.tgz") }
- it "uses the basepath of the resourc ename for the source property" do
+ it "sets the default action as :create" do
+ expect(resource.action).to eql([:create])
+ end
+
+ it "supports :create, :create_if_missing, :delete, :touch actions" do
+ expect { resource.action :create }.not_to raise_error
+ expect { resource.action :create_if_missing }.not_to raise_error
+ expect { resource.action :delete }.not_to raise_error
+ expect { resource.action :touch }.not_to raise_error
+ end
+
+ it "uses the basepath of the resource name for the source property" do
expect(resource.source).to eq("sourcecode_tarball.tgz")
end
it "source property accepts Strings" do
- resource.name("config_file.conf")
+ resource.source("config_file.conf")
expect(resource.source).to eq("config_file.conf")
end